From 1dc7ede233ed3a537cbd9b52c16ed73ddfd33bcc Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 7 May 2019 12:45:49 +0200 Subject: [PATCH] Add some move semantics. --- libdevcore/Whiskers.cpp | 16 ++++++++-------- libdevcore/Whiskers.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libdevcore/Whiskers.cpp b/libdevcore/Whiskers.cpp index a6db35c8e..5ef89028d 100644 --- a/libdevcore/Whiskers.cpp +++ b/libdevcore/Whiskers.cpp @@ -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> const& _values +Whiskers& Whiskers::operator()( + string _listParameter, + vector> _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; } diff --git a/libdevcore/Whiskers.h b/libdevcore/Whiskers.h index 21d46af4c..2ec4f88d2 100644 --- a/libdevcore/Whiskers.h +++ b/libdevcore/Whiskers.h @@ -57,14 +57,14 @@ public: using StringMap = std::map; using StringListMap = std::map>; - explicit Whiskers(std::string const& _template); + explicit Whiskers(std::string _template); /// Sets a single parameter, . - Whiskers& operator()(std::string const& _parameter, std::string const& _value); + Whiskers& operator()(std::string _parameter, std::string _value); /// Sets a list parameter, <#listName> . Whiskers& operator()( - std::string const& _listParameter, - std::vector const& _values + std::string _listParameter, + std::vector _values ); std::string render() const;