Add some move semantics.

This commit is contained in:
chriseth 2019-05-07 12:45:49 +02:00
parent 2370eefa74
commit 1dc7ede233
2 changed files with 12 additions and 12 deletions

View File

@ -30,12 +30,12 @@
using namespace std;
using namespace dev;
Whiskers::Whiskers(string const& _template):
m_template(_template)
Whiskers::Whiskers(string _template):
m_template(move(_template))
{
}
Whiskers& Whiskers::operator ()(string const& _parameter, string const& _value)
Whiskers& Whiskers::operator()(string _parameter, string _value)
{
assertThrow(
m_parameters.count(_parameter) == 0,
@ -47,14 +47,14 @@ Whiskers& Whiskers::operator ()(string const& _parameter, string const& _value)
WhiskersError,
_parameter + " already set as list parameter."
);
m_parameters[_parameter] = _value;
m_parameters[move(_parameter)] = move(_value);
return *this;
}
Whiskers& Whiskers::operator ()(
string const& _listParameter,
vector<map<string, string>> const& _values
Whiskers& Whiskers::operator()(
string _listParameter,
vector<map<string, string>> _values
)
{
assertThrow(
@ -67,7 +67,7 @@ Whiskers& Whiskers::operator ()(
WhiskersError,
_listParameter + " already set as value parameter."
);
m_listParameters[_listParameter] = _values;
m_listParameters[move(_listParameter)] = move(_values);
return *this;
}

View File

@ -57,14 +57,14 @@ public:
using StringMap = std::map<std::string, std::string>;
using StringListMap = std::map<std::string, std::vector<StringMap>>;
explicit Whiskers(std::string const& _template);
explicit Whiskers(std::string _template);
/// Sets a single parameter, <paramName>.
Whiskers& operator()(std::string const& _parameter, std::string const& _value);
Whiskers& operator()(std::string _parameter, std::string _value);
/// Sets a list parameter, <#listName> </listName>.
Whiskers& operator()(
std::string const& _listParameter,
std::vector<StringMap> const& _values
std::string _listParameter,
std::vector<StringMap> _values
);
std::string render() const;