Deployed a few more cases of std::map::emplace

I missed these since somehow the make_pair calls were missing the std namespace specifier.
This commit is contained in:
Charles Dang 2017-05-06 22:16:03 +11:00
parent 7d68b4ffba
commit 79ca2aaff4
7 changed files with 12 additions and 11 deletions

View file

@ -230,7 +230,7 @@ public:
if (c) {
assert (c->get_id()== this->get_name());
where_ = c;
aspects_.insert(make_pair(this->get_name(),c));
aspects_.emplace(this->get_name(),c);
} else {
LOG_STREAM(debug, aspect::log()) << "typesafe_known_aspect [" << this->get_name() << "] : while setting aspect, got null. this might be caused by invalid [aspect] WML" << std::endl;
}
@ -493,7 +493,7 @@ public:
return;
}
factory_ptr ptr_to_this(this);
get_list().insert(make_pair(name,ptr_to_this));
get_list().emplace(name,ptr_to_this);
}
virtual ~aspect_factory() {}
@ -536,7 +536,7 @@ public:
lua_aspect_factory( const std::string &name )
{
factory_ptr ptr_to_this(this);
get_list().insert(make_pair(name,ptr_to_this));
get_list().emplace(name,ptr_to_this);
}
virtual ~lua_aspect_factory() {}

View file

@ -139,7 +139,7 @@ public:
return;
}
factory_ptr ptr_to_this(this);
get_list().insert(make_pair(name,ptr_to_this));
get_list().emplace(name,ptr_to_this);
}
virtual ~engine_factory() {}

View file

@ -198,7 +198,7 @@ public:
return;
}
factory_ptr ptr_to_this(this);
get_list().insert(make_pair(name,ptr_to_this));
get_list().emplace(name,ptr_to_this);
}
virtual ~goal_factory() {}

View file

@ -172,7 +172,7 @@ public:
return;
}
factory_ptr ptr_to_this(this);
get_list().insert(make_pair(name,ptr_to_this));
get_list().emplace(name,ptr_to_this);
}
virtual ~candidate_action_factory() {}

View file

@ -121,7 +121,7 @@ public:
return;
}
factory_ptr ptr_to_this(this);
get_list().insert(make_pair(name,ptr_to_this));
get_list().emplace(name,ptr_to_this);
}
virtual ~stage_factory() {}

View file

@ -177,7 +177,7 @@ template<typename T>
void readonly_context_impl::add_known_aspect(const std::string &name, std::shared_ptr< typesafe_aspect <T> > &where)
{
std::shared_ptr< typesafe_known_aspect <T> > ka_ptr(new typesafe_known_aspect<T>(name,where,aspects_));
known_aspects_.insert(make_pair(name,ka_ptr));
known_aspects_.emplace(name,ka_ptr);
}
readonly_context_impl::readonly_context_impl(side_context &context, const config &cfg)

View file

@ -140,9 +140,10 @@ void attack_analysis::analyze(const gamemap& map, unit_map& units,
prev_def = &bc->get_defender_combatant(prev_def);
if ( !from_cache ) {
ai_obj.unit_stats_cache().insert(
std::make_pair(cache_key, std::make_pair(bc->get_attacker_stats(),
bc->get_defender_stats())));
ai_obj.unit_stats_cache().emplace(cache_key, std::make_pair(
bc->get_attacker_stats(),
bc->get_defender_stats()
));
}
// Note we didn't fight at all if defender is already dead.