Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/bout/options.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public:

/// Return true if this value has attribute \p key
bool hasAttribute(const std::string& key) const {
return attributes.find(key) != attributes.end();
return attributes.contains(key);
}

/// Set attributes, overwriting any already set
Expand Down Expand Up @@ -579,7 +579,7 @@ public:
value_used = true; // Note this is mutable

output_info << "\tOption " << full_name << " = " << val;
if (attributes.count("source")) {
if (attributes.contains("source")) {
// Specify the source of the setting
output_info << " (" << bout::utils::variantToString(attributes.at("source")) << ")";
}
Expand Down Expand Up @@ -907,7 +907,7 @@ private:
// If already set, and not time evolving then check for changing values
// If a variable has a "time_dimension" attribute then it is assumed
// that updates to the value is ok and don't need to be forced.
if (isSet() && (attributes.find("time_dimension") == attributes.end())) {
if (isSet() && (!attributes.contains("time_dimension"))) {
// Check if current value the same as new value
if (!bout::utils::variantEqualTo(value, val)) {
if (force or !bout::utils::variantEqualTo(attributes["source"], source)) {
Expand Down
6 changes: 3 additions & 3 deletions src/sys/options.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,9 @@ bout::details::OptionsFormatterBase::format(const Options& options,
fmt::format_to(ctx.out(), " = {}", as_str);
}

const bool has_doc = options.attributes.count("doc") != 0U;
const bool has_source = options.attributes.count("source") != 0U;
const bool has_type = options.attributes.count("type") != 0U;
const bool has_doc = options.attributes.contains("doc");
const bool has_source = options.attributes.contains("source");
const bool has_type = options.attributes.contains("type");

std::vector<std::string> comments;

Expand Down
Loading