mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Use emplace() instead of insert() where applicable for maps.
This commit is contained in:
@ -333,7 +333,7 @@ unsigned int NetPlayServer::OnConnect(ENetPeer* socket)
|
||||
// add client to the player list
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
|
||||
m_players.insert(std::pair<PlayerId, Client>(*(PlayerId *)player.socket->data, player));
|
||||
m_players.emplace(*(PlayerId *)player.socket->data, player);
|
||||
UpdatePadMapping(); // sync pad mappings with everyone
|
||||
UpdateWiimoteMapping();
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ using namespace Gen;
|
||||
{
|
||||
for (const auto& e : b.linkData)
|
||||
{
|
||||
links_to.insert(std::pair<u32, int>(e.exitAddress, block_num));
|
||||
links_to.emplace(e.exitAddress, block_num);
|
||||
}
|
||||
|
||||
LinkBlock(block_num);
|
||||
|
@ -257,9 +257,12 @@ static std::map<double, int> GetSavedStates()
|
||||
if (ReadHeader(filename, header))
|
||||
{
|
||||
double d = Common::Timer::GetDoubleTime() - header.time;
|
||||
|
||||
// increase time until unique value is obtained
|
||||
while (m.find(d) != m.end()) d += .001;
|
||||
m.insert(std::pair<double,int>(d, i));
|
||||
while (m.find(d) != m.end())
|
||||
d += .001;
|
||||
|
||||
m.emplace(d, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user