std::ostringstream stream;
- if (array(m->row, m->col) != "" && m->prefix >= 0)
+ if (!array(m->row, m->col).empty() && m->prefix >= 0)
stream << "+";
if (m->prefix != 1.)
stream << m->prefix << 'x';
, filename()
, data_is_preloaded(false)
{
- Assert(v.filename == "", ExcInvalidCopyOperation());
+ Assert(v.filename.empty(), ExcInvalidCopyOperation());
}
// first, before killing the vector
// itself
- if (filename != "")
+ if (!filename.empty())
{
try
{
SwappableVector<number>::operator=(const SwappableVector<number> &v)
{
// if necessary, first delete data
- if (filename != "")
+ if (!filename.empty())
kill_file();
// if in MT mode, block all other
// that has not been deleted in the
// meantime, then we kill that file
// first
- if (filename != "")
+ if (!filename.empty())
kill_file();
filename = name;
{
(void)set_flag;
- Assert(filename != "", ExcInvalidFilename(filename));
+ Assert(!filename.empty(), ExcInvalidFilename(filename));
Assert(this->size() == 0, ExcSizeNonzero());
std::ifstream tmp_in(filename.c_str());
// is most probably an error, not?
Assert(data_is_preloaded == false, ExcInternalError());
- if (filename != "")
+ if (!filename.empty())
{
int status = std::remove(filename.c_str());
(void)status;
// underscores unless a vector name has been specified
out << "VECTORS ";
- if (std::get<2>(nonscalar_data_range) != "")
+ if (!std::get<2>(nonscalar_data_range).empty())
out << std::get<2>(nonscalar_data_range);
else
{
// underscores unless a vector name has been specified
out << " <DataArray type=\"Float32\" Name=\"";
- if (std::get<2>(nonscalar_data_range) != "")
+ if (!std::get<2>(nonscalar_data_range).empty())
out << std::get<2>(nonscalar_data_range);
else
{
// underscores unless a vector name has been specified
out << " <DataArray type=\"Float32\" Name=\"";
- if (name != "")
+ if (!name.empty())
out << name;
else
{
// underscores unless a vector name has been specified
out << " <PDataArray type=\"Float32\" Name=\"";
- if (std::get<2>(nonscalar_data_range) != "")
+ if (!std::get<2>(nonscalar_data_range).empty())
out << std::get<2>(nonscalar_data_range);
else
{
// Determine the vector name. Concatenate all the component names with
// double underscores unless a vector name has been specified
- if (std::get<2>(nonscalar_data_ranges[n_th_vector]) != "")
+ if (!std::get<2>(nonscalar_data_ranges[n_th_vector]).empty())
{
vector_name = std::get<2>(nonscalar_data_ranges[n_th_vector]);
}
for (const auto &range : ranges)
{
const std::string &name = std::get<2>(range);
- if (name != "")
+ if (!name.empty())
{
Assert(all_names.find(name) == all_names.end(),
ExcMessage(
while ((header.size() != 0) && (header[header.size() - 1] == ' '))
header.erase(header.size() - 1);
}
- while ((header == "") && in);
+ while ((header.empty()) && in);
std::ostringstream s;
s << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]";
ExceptionBase::what() const noexcept
{
// If no error c_string was generated so far, do it now:
- if (what_str == "")
+ if (what_str.empty())
{
#ifdef DEAL_II_HAVE_GLIBC_STACKTRACE
// We have deferred the symbol lookup to this point to avoid costly
std::string
ParameterAcceptor::get_section_name() const
{
- return (section_name != "" ? section_name :
- boost::core::demangle(typeid(*this).name()));
+ return (!section_name.empty() ? section_name :
+ boost::core::demangle(typeid(*this).name()));
}
ParameterHandler & prm)
{
declare_all_parameters(prm);
- if (filename != "")
+ if (!filename.empty())
{
// check the extension of input file
if (filename.substr(filename.find_last_of('.') + 1) == "prm")
"Invalid extension of parameter file. Please use .prm or .xml"));
}
- if (output_filename != "")
+ if (!output_filename.empty())
{
std::ofstream outfile(output_filename.c_str());
Assert(outfile, ExcIO());
// make sure we have a corresponding entry in the destination
// object as well
const std::string full_path =
- (current_path == "" ? p->first :
- current_path + path_separator + p->first);
+ (current_path.empty() ? p->first :
+ current_path + path_separator + p->first);
const std::string new_value = p->second.get<std::string>("value");
AssertThrow(destination.get_optional<std::string>(full_path) &&
{
// it must be a subsection
read_xml_recursively(p->second,
- (current_path == "" ?
+ (current_path.empty() ?
p->first :
current_path + path_separator + p->first),
path_separator,
// try again with the suffix appended, unless there is
// no suffix
- if (suffix != "")
+ if (!suffix.empty())
{
real_name = *path + filename + suffix;
if (debug > 1)
std::string(map_entry.first);
}
- if (infostring == "")
+ if (infostring.empty())
infostring = "<none>";
AssertNothrow(counter == 0,
object_info = &typeid(*this);
++counter;
- const std::string name = (id != "") ? id : unknown_subscriber;
+ const std::string name = (!id.empty()) ? id : unknown_subscriber;
map_iterator it = counter_map.find(name);
if (it == counter_map.end())
Subscriptor::unsubscribe(std::atomic<bool> *const validity,
const std::string & id) const
{
- const std::string name = (id != "") ? id : unknown_subscriber;
+ const std::string name = (!id.empty()) ? id : unknown_subscriber;
if (counter == 0)
{
AssertNothrow(counter > 0, ExcNoSubscriber(object_info->name(), name));
}
out << "\\end{tabular}" << std::endl << "\\end{center}" << std::endl;
- if (tex_table_caption != "")
+ if (!tex_table_caption.empty())
out << "\\caption{" << tex_table_caption << "}" << std::endl;
- if (tex_table_label != "")
+ if (!tex_table_label.empty())
out << "\\label{" << tex_table_label << "}" << std::endl;
out << "\\end{table}" << std::endl;
if (with_header)
std::lock_guard<std::mutex> lock(mutex);
- if (section_name != "")
+ if (!section_name.empty())
{
Assert(sections.find(section_name) != sections.end(),
ExcMessage("Cannot delete a section that was never created."));
// if no string is given, exit the last
// active section.
const std::string actual_section_name =
- (section_name == "" ? active_sections.back() : section_name);
+ (section_name.empty() ? active_sections.back() : section_name);
sections[actual_section_name].timer.stop();
sections[actual_section_name].total_wall_time +=
{
std::string base_name = prm.output_base_name;
char dir_template[] = "ctfbc-XXXXXX";
- if (base_name == "")
+ if (base_name.empty())
{
const char *temp = mkdtemp(dir_template);
AssertThrow(temp != nullptr,
set = keyword;
break;
}
- if (set == "")
+ if (set.empty())
// keep ignoring everything until the next SCALARS
// keyword
continue;