1
0
forked from 0ad/0ad

Revert emplace for associative containers. Fixes #3366.

GCC < 4.8.0 does not support emplace for those.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44436.

This was SVN commit r16922.
This commit is contained in:
leper 2015-08-19 03:32:47 +00:00
parent 674f49f1a8
commit 36c6b50944
11 changed files with 21 additions and 22 deletions

View File

@ -165,7 +165,7 @@ bool CObjectEntry::BuildVariation(const std::vector<std::set<CStr> >& selections
{
CSkeletonAnim* anim = model->BuildAnimation(it->second.m_FileName, name, it->second.m_Speed, it->second.m_ActionPos, it->second.m_ActionPos2, it->second.m_SoundPos);
if (anim)
m_Animations.emplace(std::move(name), anim);
m_Animations.insert(std::make_pair(name, anim));
}
}

View File

@ -94,7 +94,7 @@ typename CShaderParams<value_t>::SItems* CShaderParams<value_t>::GetInterned(con
ENSURE(std::adjacent_find(items.items.begin(), items.items.end(), std::binary_negate<Cmp>(Cmp())) == items.items.end());
shared_ptr<SItems> ptr(new SItems(items));
s_InternedItems.emplace(items, ptr);
s_InternedItems.insert(std::make_pair(items, ptr));
return ptr.get();
}

View File

@ -216,7 +216,7 @@ Status dir_watch_Add(const OsPath& path, PDirWatch& dirWatch)
dirWatch.swap(tmpDirWatch);
dirWatch->path = path;
dirWatch->reqnum = wd;
g_paths.emplace(wd, dirWatch);
g_paths.insert(std::make_pair(wd, dirWatch));
return INFO::OK;
}

View File

@ -637,7 +637,7 @@ void XmppClient::SendMUCMessage(const std::string& message)
*/
void XmppClient::PushGuiMessage(XmppClient::GUIMessage message)
{
m_GuiMessageQueue.emplace_back(message);
m_GuiMessageQueue.push_back(std::move(message));
}
/**

View File

@ -289,8 +289,7 @@ void CNetTurnManager::AddCommand(int client, int player, JS::HandleValue data, u
return;
}
SimulationCommand cmd(player, m_Simulation2.GetScriptInterface().GetContext(), data);
m_QueuedCommands[turn - (m_CurrentTurn+1)][client].emplace_back(std::move(cmd));
m_QueuedCommands[turn - (m_CurrentTurn+1)][client].emplace_back(player, m_Simulation2.GetScriptInterface().GetContext(), data);
}
void CNetTurnManager::FinishedAllCommands(u32 turn, u32 turnLength)

View File

@ -113,7 +113,7 @@ static CStrInternInternals* GetString(const char* str, size_t len)
return it->second.get();
shared_ptr<CStrInternInternals> internals(new CStrInternInternals(str, len));
g_Strings.emplace(internals->data, internals);
g_Strings.insert(std::make_pair(internals->data, internals));
return internals.get();
}

View File

@ -184,7 +184,7 @@ void CConfigDB::SetValueString(EConfigNamespace ns, const CStr& name, const CStr
CScopeLock s(&cfgdb_mutex);
TConfigMap::iterator it = m_Map[ns].find(name);
if (it == m_Map[ns].end())
it = m_Map[ns].emplace_hint(m_Map[ns].begin(), name, CConfigValueSet(1));
it = m_Map[ns].insert(m_Map[ns].begin(), make_pair(name, CConfigValueSet(1)));
it->second[0] = value;
}

View File

@ -335,16 +335,16 @@ void InitKeyNameMap()
{
for (const SKeycodeMapping* it = keycodeMapping; it->keycode != 0; ++it)
{
keymap.emplace(std::move(CStr(it->keyname).LowerCase()), it->keycode);
if (it->altkeyname)
keymap.emplace(std::move(CStr(it->altkeyname).LowerCase()), it->keycode);
keymap.insert(std::pair<CStr,int>(CStr(it->keyname).LowerCase(), it->keycode));
if(it->altkeyname)
keymap.insert(std::pair<CStr,int>(CStr(it->altkeyname).LowerCase(), it->keycode));
}
// Extra mouse buttons.
for (int i = 1; i < 256; ++i) // There is no mouse 0
{
keymap.emplace("mousebutton" + CStr::FromInt(i), MOUSE_BASE + i);
keymap.emplace("mousen" + CStr::FromInt(i), MOUSE_BASE + i);
keymap.insert(std::pair<CStr,int>("mousebutton" + CStr::FromInt(i), MOUSE_BASE + i));
keymap.insert(std::pair<CStr,int>("mousen" + CStr::FromInt(i), MOUSE_BASE + i));
}
}

View File

@ -56,7 +56,7 @@ void CXeromyces::Startup()
xmlInitParser();
xmlSetStructuredErrorFunc(NULL, &errorHandler);
CScopeLock lock(g_ValidatorCacheLock);
g_ValidatorCache.emplace(std::string(), RelaxNGValidator());
g_ValidatorCache.insert(std::make_pair(std::string(), RelaxNGValidator()));
g_XeromycesStarted = true;
}
@ -86,7 +86,7 @@ bool CXeromyces::AddValidator(const PIVFS& vfs, const std::string& name, const V
std::map<const std::string, RelaxNGValidator>::iterator it = g_ValidatorCache.find(name);
if (it != g_ValidatorCache.end())
g_ValidatorCache.erase(it);
g_ValidatorCache.emplace(name, validator);
g_ValidatorCache.insert(std::make_pair(name, validator));
}
return true;
}

View File

@ -94,7 +94,7 @@ struct SerializeMap
V v;
KS()(deserialize, "key", k);
VS()(deserialize, "value", v);
value.emplace(k, v);
value.insert(std::make_pair(k, v));
}
}
@ -112,7 +112,7 @@ struct SerializeMap
V v;
KS()(deserialize, "key", k);
VS()(deserialize, "value", v, context);
value.emplace(k, v);
value.insert(std::make_pair(k, v));
}
}
};

View File

@ -544,7 +544,7 @@ void CComponentManager::RegisterComponentType(InterfaceId iid, ComponentTypeId c
const char* name, const std::string& schema)
{
ComponentType c(CT_Native, iid, alloc, dealloc, name, schema, std::move(DefPersistentRooted<JS::Value>()));
m_ComponentTypesById.emplace(cid, std::move(c));
m_ComponentTypesById.insert(std::make_pair(cid, std::move(c)));
m_ComponentTypeIdsByName[name] = cid;
}
@ -552,7 +552,7 @@ void CComponentManager::RegisterComponentTypeScriptWrapper(InterfaceId iid, Comp
DeallocFunc dealloc, const char* name, const std::string& schema)
{
ComponentType c(CT_ScriptWrapper, iid, alloc, dealloc, name, schema, std::move(DefPersistentRooted<JS::Value>()));
m_ComponentTypesById.emplace(cid, std::move(c));
m_ComponentTypesById.insert(std::make_pair(cid, std::move(c)));
m_ComponentTypeIdsByName[name] = cid;
// TODO: merge with RegisterComponentType
}
@ -778,8 +778,8 @@ IComponent* CComponentManager::ConstructComponent(CEntityHandle ent, ComponentTy
component->SetSimContext(m_SimContext);
// Store a reference to the new component
emap1.emplace(ent.GetId(), component);
emap2.emplace(ent.GetId(), component);
emap1.insert(std::make_pair(ent.GetId(), component));
emap2.insert(std::make_pair(ent.GetId(), component));
// TODO: We need to more careful about this - if an entity is constructed by a component
// while we're iterating over all components, this will invalidate the iterators and everything
// will break.
@ -801,7 +801,7 @@ void CComponentManager::AddMockComponent(CEntityHandle ent, InterfaceId iid, ICo
boost::unordered_map<entity_id_t, IComponent*>& emap1 = m_ComponentsByInterface.at(iid);
if (emap1.find(ent.GetId()) != emap1.end())
debug_warn(L"Multiple components for interface");
emap1.emplace(ent.GetId(), &component);
emap1.insert(std::make_pair(ent.GetId(), &component));
SEntityComponentCache* cache = ent.GetComponentCache();
ENSURE(cache != NULL && iid < (int)cache->numInterfaces && cache->interfaces[iid] == NULL);