Skip to content

Commit

Permalink
Fix some more warnings
Browse files Browse the repository at this point in the history
Fixes a warning regarding copies in for loops with auto variables when
iterating over a std::map. Also fixes a warning regarding return value
optimization due to a std::move.
  • Loading branch information
sleweke committed Jun 7, 2021
1 parent 6289c31 commit cb14767
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libcadet/model/ModelSystemImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ std::unordered_map<ParameterId, double> ModelSystem::getAllParameterValues() con
for (IUnitOperation* m : _models)
{
const std::unordered_map<ParameterId, double> localData = m->getAllParameterValues();
for (const std::pair<ParameterId, double>& val : localData)
for (const std::pair<const ParameterId, double>& val : localData)
data[val.first] = val.second;
}

Expand Down
4 changes: 2 additions & 2 deletions src/libcadet/model/ModelUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void getAllParameterValues(std::unordered_map<ParameterId, double>& data, const
return;

const std::unordered_map<ParameterId, double> localData = items[0]->getAllParameterValues();
for (const std::pair<ParameterId, double>& val : localData)
for (const std::pair<const ParameterId, double>& val : localData)
data[val.first] = val.second;
}
else
Expand All @@ -145,7 +145,7 @@ void getAllParameterValues(std::unordered_map<ParameterId, double>& data, const
continue;

const std::unordered_map<ParameterId, double> localData = bm->getAllParameterValues();
for (const std::pair<ParameterId, double>& val : localData)
for (const std::pair<const ParameterId, double>& val : localData)
data[val.first] = val.second;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ExtendedMobilePhaseModulatorLangmuirBindingBase : public ParamHandlerBindi
{
const bool res = BindingModelBase::configureModelDiscretization(paramProvider, nComp, nBound, boundOffset);

_mode = std::move(paramProvider.getIntArray("EMPM_COMP_MODE"));
_mode = paramProvider.getIntArray("EMPM_COMP_MODE");
if (_mode.size() < nComp)
throw InvalidParameterException("Not enough elements in EMPM_COMP_MODE (expected " + std::to_string(nComp) + ", got " + std::to_string(_mode.size()) + ")");

Expand Down

0 comments on commit cb14767

Please sign in to comment.