@@ -101,11 +101,11 @@ void UniValue::setObject()
101101 typ = VOBJ;
102102}
103103
104- void UniValue::push_back (const UniValue& val_ )
104+ void UniValue::push_back (UniValue val )
105105{
106106 checkType (VARR);
107107
108- values.push_back (val_ );
108+ values.push_back (std::move (val) );
109109}
110110
111111void UniValue::push_backV (const std::vector<UniValue>& vec)
@@ -115,32 +115,32 @@ void UniValue::push_backV(const std::vector<UniValue>& vec)
115115 values.insert (values.end (), vec.begin (), vec.end ());
116116}
117117
118- void UniValue::__pushKV (const std::string& key, const UniValue& val_ )
118+ void UniValue::__pushKV (std::string key, UniValue val )
119119{
120120 checkType (VOBJ);
121121
122- keys.push_back (key);
123- values.push_back (val_ );
122+ keys.push_back (std::move ( key) );
123+ values.push_back (std::move (val) );
124124}
125125
126- void UniValue::pushKV (const std::string& key, const UniValue& val_ )
126+ void UniValue::pushKV (std::string key, UniValue val )
127127{
128128 checkType (VOBJ);
129129
130130 size_t idx;
131131 if (findKey (key, idx))
132- values[idx] = val_ ;
132+ values[idx] = std::move (val) ;
133133 else
134- __pushKV (key, val_ );
134+ __pushKV (std::move ( key), std::move (val) );
135135}
136136
137- void UniValue::pushKVs (const UniValue& obj)
137+ void UniValue::pushKVs (UniValue obj)
138138{
139139 checkType (VOBJ);
140140 obj.checkType (VOBJ);
141141
142142 for (size_t i = 0 ; i < obj.keys .size (); i++)
143- __pushKV (obj.keys [i], obj.values .at (i));
143+ __pushKV (std::move ( obj.keys . at (i)), std::move ( obj.values .at (i) ));
144144}
145145
146146void UniValue::getObjMap (std::map<std::string,UniValue>& kv) const
0 commit comments