Round one of fixes to avoid ridiculous numbers of spurious copy constructor and destructor calls.

Most of these fixes involve calls to BOOST_FOREACH to iterate over a map or unordered_map where the
iterator type didn't perfectly match the internal type, so a reference into the map couldn't be created
and a new value/content pair had to be created for each iteration.
This commit is contained in:
JoelKatz
2012-12-17 20:20:24 -08:00
parent 961ac4690e
commit 2a06686b7c
14 changed files with 29 additions and 27 deletions

View File

@@ -81,8 +81,8 @@ bool ParameterNode::addNode(const std::string& name, Parameter::ref node)
Json::Value ParameterNode::getValue(int i) const
{
Json::Value v(Json::objectValue);
typedef std::pair<std::string, Parameter::pointer> string_ref_pair;
BOOST_FOREACH(string_ref_pair it, mChildren)
typedef std::map<std::string, Parameter::pointer>::value_type string_ref_pair;
BOOST_FOREACH(const string_ref_pair& it, mChildren)
{
v[it.first] = it.second->getValue(i);
}
@@ -95,8 +95,8 @@ bool ParameterNode::setValue(const Json::Value& value, Json::Value& error)
error["error"] = "Cannot end on an inner node";
Json::Value nodes(Json::arrayValue);
typedef std::pair<std::string, Parameter::pointer> string_ref_pair;
BOOST_FOREACH(string_ref_pair it, mChildren)
typedef std::map<std::string, Parameter::pointer>::value_type string_ref_pair;
BOOST_FOREACH(const string_ref_pair& it, mChildren)
{
nodes.append(it.first);
}