Skip to content

Commit

Permalink
Refactor the parse() method for StiffMatrix to avoid cpp-check warning
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-bhuiyan committed Aug 9, 2024
1 parent f989897 commit ae048d9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utilities/scripts/windio_mapped_structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,13 @@ struct StiffMatrix {
void parse(const YAML::Node& node) {
grid = node["grid"] ? node["grid"].as<std::vector<double>>() : std::vector<double>();
if (node["values"]) {
for (const auto& item : node["values"]) {
values.push_back(item.as<std::vector<double>>());
}
std::transform(
node["values"].begin(), node["values"].end(), std::back_inserter(values),
[](const auto& item) {
// use 'template' keyword to treat 'as' as a dependent template name
return item.template as<std::vector<double>>();
}
);
}
}
};
Expand Down

0 comments on commit ae048d9

Please sign in to comment.