mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 22:56:24 +00:00
refactor(Core/Misc): Use emplace_back instead of push_back to avoid extra copy/m… (#20114)
refactor: Use emplace_back instead of push_back to avoid extra copy/move operations
This commit is contained in:
@@ -112,7 +112,7 @@ namespace MMAP
|
||||
mapID = uint32(atoi(file.substr(0, file.size() - 8).c_str()));
|
||||
if (std::find(m_tiles.begin(), m_tiles.end(), mapID) == m_tiles.end())
|
||||
{
|
||||
m_tiles.emplace_back(MapTiles(mapID, new std::set<uint32>));
|
||||
m_tiles.emplace_back(mapID, new std::set<uint32>);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ namespace MMAP
|
||||
mapID = uint32(atoi(file.substr(0, file.size() - 7).c_str()));
|
||||
if (std::find(m_tiles.begin(), m_tiles.end(), mapID) == m_tiles.end())
|
||||
{
|
||||
m_tiles.emplace_back(MapTiles(mapID, new std::set<uint32>));
|
||||
m_tiles.emplace_back(mapID, new std::set<uint32>);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ namespace MMAP
|
||||
return (*itr).m_tiles;
|
||||
|
||||
std::set<uint32>* tiles = new std::set<uint32>();
|
||||
m_tiles.emplace_back(MapTiles(mapID, tiles));
|
||||
m_tiles.emplace_back(mapID, tiles);
|
||||
return tiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace MMAP
|
||||
uint32 m_mapId;
|
||||
std::set<uint32>* m_tiles{nullptr};
|
||||
|
||||
bool operator==(uint32 id)
|
||||
bool operator==(uint32 id) const
|
||||
{
|
||||
return m_mapId == id;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace MMAP
|
||||
do
|
||||
{
|
||||
if ((findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||
fileList.push_back(std::string(findFileInfo.cFileName));
|
||||
fileList.emplace_back(findFileInfo.cFileName);
|
||||
} while (FindNextFile(hFind, &findFileInfo));
|
||||
|
||||
FindClose(hFind);
|
||||
|
||||
Reference in New Issue
Block a user