Get rid of push_back in favor of emplace_back
Change-Id: I4a0096441ed725eb21e42eb9cc17a173929e3788
diff --git a/src/sysrepo_access.cpp b/src/sysrepo_access.cpp
index 61ff560..17c86a0 100644
--- a/src/sysrepo_access.cpp
+++ b/src/sysrepo_access.cpp
@@ -197,15 +197,15 @@
for (unsigned int i = 0; i < items->val_cnt(); i++) {
auto value = leafValueFromVal(items->val(i));
if (m_schema->nodeType(items->val(i)->xpath()) == yang::NodeTypes::LeafList) {
- res.push_back({items->val(i)->xpath(), special_{SpecialValue::LeafList}});
+ res.emplace_back(items->val(i)->xpath(), special_{SpecialValue::LeafList});
std::string leafListPath = items->val(i)->xpath();
while (i < items->val_cnt() && leafListPath == items->val(i)->xpath()) {
auto leafListValue = leafDataToString(leafValueFromVal(items->val(i)));
- res.push_back({items->val(i)->xpath() + "[.="s + escapeListKeyString(leafListValue) + "]", leafListValue});
+ res.emplace_back(items->val(i)->xpath() + "[.="s + escapeListKeyString(leafListValue) + "]", leafListValue);
i++;
}
} else {
- res.push_back({items->val(i)->xpath(), value});
+ res.emplace_back(items->val(i)->xpath(), value);
}
}
};
@@ -315,7 +315,7 @@
Tree res;
for (size_t i = 0; i < output->val_cnt(); ++i) {
const auto& v = output->val(i);
- res.push_back({std::string(v->xpath()).substr(joinPaths(path, "/").size()), leafValueFromVal(v)});
+ res.emplace_back(std::string(v->xpath()).substr(joinPaths(path, "/").size()), leafValueFromVal(v));
}
return res;
}
@@ -354,7 +354,7 @@
}
for (unsigned int i = 0; i < schemas->schema_cnt(); i++) {
auto schema = schemas->schema(i);
- res.push_back(schema);
+ res.emplace_back(schema);
}
return res;
}
@@ -427,7 +427,7 @@
auto leaf = libyang::Data_Node_Leaf_List{*(vec.begin())};
instanceRes.emplace(key->name(), leafValueFromValue(leaf.value(), leaf.leaf_type()->base()));
}
- res.push_back(instanceRes);
+ res.emplace_back(instanceRes);
}
return res;