Skip to content

Commit 9cba97f

Browse files
committed
Initialize a ParameterMap with a std::map
1 parent f8519e8 commit 9cba97f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/coek/coek/compact/parameter_map.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ class ParameterMap : public ParameterAssocArray {
129129
ParameterMap& value(double value);
130130
/** Set the initial parameter value. \returns the parameter object. */
131131
ParameterMap& value(const Expression& value);
132+
template <typename KeyType, typename ValueType>
133+
ParameterMap& value(const std::map<KeyType,ValueType>& values)
134+
{
135+
for (auto& [key,value]: values) {
136+
this->operator()(key).value(value);
137+
}
138+
return *this;
139+
}
132140

133141
/** Set the name of the parameter. \returns the parameter object */
134142
ParameterMap& name(const std::string& name);

0 commit comments

Comments
 (0)