diff --git a/Common/Data/Format/IniFile.cpp b/Common/Data/Format/IniFile.cpp index 32fcf43b68..cd2a658e5c 100644 --- a/Common/Data/Format/IniFile.cpp +++ b/Common/Data/Format/IniFile.cpp @@ -206,7 +206,7 @@ void Section::Set(const char* key, const char* newValue) else { // The key did not already exist in this section - let's add it. - lines.push_back(std::string(key) + " = " + EscapeComments(newValue)); + lines.emplace_back(std::string(key) + " = " + EscapeComments(newValue)); } } @@ -272,7 +272,7 @@ void Section::Set(const char* key, const std::vector& newValues) } void Section::AddComment(const std::string &comment) { - lines.push_back("# " + comment); + lines.emplace_back("# " + comment); } bool Section::Get(const char* key, std::vector& values) diff --git a/Common/File/DirListing.cpp b/Common/File/DirListing.cpp index abe5ff3af8..2f7178847b 100644 --- a/Common/File/DirListing.cpp +++ b/Common/File/DirListing.cpp @@ -148,7 +148,7 @@ std::vector ApplyFilter(std::vector files, const std::string tmp; while (*filter) { if (*filter == ':') { - filters.insert("." + tmp); + filters.emplace("." + tmp); tmp.clear(); } else { tmp.push_back(*filter); @@ -156,7 +156,7 @@ std::vector ApplyFilter(std::vector files, const filter++; } if (!tmp.empty()) - filters.insert("." + tmp); + filters.emplace("." + tmp); } auto pred = [&](const File::FileInfo &info) { diff --git a/Common/GPU/OpenGL/GLFeatures.cpp b/Common/GPU/OpenGL/GLFeatures.cpp index bf9a639e67..aa79ac5941 100644 --- a/Common/GPU/OpenGL/GLFeatures.cpp +++ b/Common/GPU/OpenGL/GLFeatures.cpp @@ -51,7 +51,7 @@ static void ParseExtensionsString(const std::string& str, std::set size_t next = 0; for (size_t pos = 0, len = str.length(); pos < len; ++pos) { if (str[pos] == ' ') { - output.insert(str.substr(next, pos - next)); + output.emplace(str.substr(next, pos - next)); // Skip the delimiter itself. next = pos + 1; } @@ -60,7 +60,7 @@ static void ParseExtensionsString(const std::string& str, std::set if (next == 0 && str.length() != 0) { output.insert(str); } else if (next < str.length()) { - output.insert(str.substr(next)); + output.emplace(str.substr(next)); } } diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index e45c148851..4fddf1252e 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -1432,7 +1432,7 @@ std::vector VKContext::GetFeatureList() const { AddFeature(features, "occlusionQueryPrecise", available.occlusionQueryPrecise, enabled.occlusionQueryPrecise); AddFeature(features, "multiDrawIndirect", available.multiDrawIndirect, enabled.multiDrawIndirect); - features.push_back(std::string("Preferred depth buffer format: ") + VulkanFormatToString(vulkan_->GetDeviceInfo().preferredDepthStencilFormat)); + features.emplace_back(std::string("Preferred depth buffer format: ") + VulkanFormatToString(vulkan_->GetDeviceInfo().preferredDepthStencilFormat)); return features; } diff --git a/Common/LogReporting.cpp b/Common/LogReporting.cpp index 2189b1c7e2..0fcc78d0ad 100644 --- a/Common/LogReporting.cpp +++ b/Common/LogReporting.cpp @@ -35,7 +35,7 @@ bool ShouldLogNTimes(const char *identifier, int count) { std::lock_guard lock(logNTimesLock); auto iter = logNTimes.find(identifier); if (iter == logNTimes.end()) { - logNTimes.insert(std::pair(identifier, 1)); + logNTimes.emplace(identifier, 1); return true; } else { if (iter->second >= count) { diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index f88f6194ab..3a9e29c61a 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -273,7 +273,7 @@ void SplitString(const std::string& str, const char delim, std::vector& output) if (str[pos] == '\"' || str[pos] == '\'') { if (even) { //quoted text - output.push_back(str.substr(next, pos - next)); + output.emplace_back(str.substr(next, pos - next)); even = 0; } else { //non quoted text diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index e276e9be27..b215a92ab4 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -439,7 +439,7 @@ void SymbolMap::AddModule(const char *name, u32 address, u32 size) { // Just reactivate that one. it->start = address; it->size = size; - activeModuleEnds.insert(std::make_pair(it->start + it->size, *it)); + activeModuleEnds.emplace(it->start + it->size, *it); activeNeedUpdate_ = true; return; } @@ -452,7 +452,7 @@ void SymbolMap::AddModule(const char *name, u32 address, u32 size) { mod.index = (int)modules.size() + 1; modules.push_back(mod); - activeModuleEnds.insert(std::make_pair(mod.start + mod.size, mod)); + activeModuleEnds.emplace(mod.start + mod.size, mod); activeNeedUpdate_ = true; } @@ -559,7 +559,7 @@ void SymbolMap::AddFunction(const char* name, u32 address, u32 size, int moduleI auto active = activeFunctions.find(address); if (active != activeFunctions.end() && active->second.module == moduleIndex) { activeFunctions.erase(active); - activeFunctions.insert(std::make_pair(address, existing->second)); + activeFunctions.emplace(address, existing->second); } } else { FunctionEntry func; @@ -570,7 +570,7 @@ void SymbolMap::AddFunction(const char* name, u32 address, u32 size, int moduleI functions[symbolKey] = func; if (IsModuleActive(moduleIndex)) { - activeFunctions.insert(std::make_pair(address, func)); + activeFunctions.emplace(address, func); } } @@ -716,27 +716,27 @@ void SymbolMap::UpdateActiveSymbols() { for (auto it = functions.begin(), end = functions.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { - activeFunctions.insert(std::make_pair(it->second.start, it->second)); + activeFunctions.emplace(it->second.start, it->second); } else if (mod != activeModuleIndexes.end()) { - activeFunctions.insert(std::make_pair(mod->second + it->second.start, it->second)); + activeFunctions.emplace(mod->second + it->second.start, it->second); } } for (auto it = labels.begin(), end = labels.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { - activeLabels.insert(std::make_pair(it->second.addr, it->second)); + activeLabels.emplace(it->second.addr, it->second); } else if (mod != activeModuleIndexes.end()) { - activeLabels.insert(std::make_pair(mod->second + it->second.addr, it->second)); + activeLabels.emplace(mod->second + it->second.addr, it->second); } } for (auto it = data.begin(), end = data.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { - activeData.insert(std::make_pair(it->second.start, it->second)); + activeData.emplace(it->second.start, it->second); } else if (mod != activeModuleIndexes.end()) { - activeData.insert(std::make_pair(mod->second + it->second.start, it->second)); + activeData.emplace(mod->second + it->second.start, it->second); } } @@ -757,7 +757,7 @@ bool SymbolMap::SetFunctionSize(u32 startAddress, u32 newSize) { if (func != functions.end()) { func->second.size = newSize; activeFunctions.erase(funcInfo); - activeFunctions.insert(std::make_pair(startAddress, func->second)); + activeFunctions.emplace(startAddress, func->second); } } @@ -829,7 +829,7 @@ void SymbolMap::AddLabel(const char* name, u32 address, int moduleIndex) { auto active = activeLabels.find(address); if (active != activeLabels.end() && active->second.module == moduleIndex) { activeLabels.erase(active); - activeLabels.insert(std::make_pair(address, label)); + activeLabels.emplace(address, label); } } } else { @@ -840,7 +840,7 @@ void SymbolMap::AddLabel(const char* name, u32 address, int moduleIndex) { labels[symbolKey] = label; if (IsModuleActive(moduleIndex)) { - activeLabels.insert(std::make_pair(address, label)); + activeLabels.emplace(address, label); } } } @@ -864,7 +864,7 @@ void SymbolMap::SetLabelName(const char* name, u32 address) { auto active = activeLabels.find(address); if (active != activeLabels.end() && active->second.module == label->second.module) { activeLabels.erase(active); - activeLabels.insert(std::make_pair(address, label->second)); + activeLabels.emplace(address, label->second); } } } @@ -947,7 +947,7 @@ void SymbolMap::AddData(u32 address, u32 size, DataType type, int moduleIndex) { auto active = activeData.find(address); if (active != activeData.end() && active->second.module == moduleIndex) { activeData.erase(active); - activeData.insert(std::make_pair(address, existing->second)); + activeData.emplace(address, existing->second); } } else { DataEntry entry; @@ -958,7 +958,7 @@ void SymbolMap::AddData(u32 address, u32 size, DataType type, int moduleIndex) { data[symbolKey] = entry; if (IsModuleActive(moduleIndex)) { - activeData.insert(std::make_pair(address, entry)); + activeData.emplace(address, entry); } } } diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 5996197bda..dfcc535df0 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -1328,7 +1328,7 @@ void sendChat(std::string chatString) { std::string name = g_Config.sNickName; std::lock_guard guard(chatLogLock); - chatLog.push_back(name.substr(0, 8) + ": " + chat.message); + chatLog.emplace_back(name.substr(0, 8) + ": " + chat.message); chatMessageGeneration++; } } diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 318cae7d0c..55b7ff7044 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -2007,7 +2007,7 @@ int __KernelFreeTls(TLSPL *tls, SceUID threadID) __KernelResumeThreadFromWait(waitingThreadID, freedAddress); // Gotta watch the thread to quit as well, since they've allocated now. - tlsplThreadEndChecks.insert(std::make_pair(waitingThreadID, uid)); + tlsplThreadEndChecks.emplace(waitingThreadID, uid); // No need to continue or free it, we're done. return 0; @@ -2234,7 +2234,7 @@ int sceKernelGetTlsAddr(SceUID uid) { if (allocBlock != -1) { tls->usage[allocBlock] = threadID; - tlsplThreadEndChecks.insert(std::make_pair(threadID, uid)); + tlsplThreadEndChecks.emplace(threadID, uid); --tls->ntls.freeBlocks; needsClear = true; } diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index 2cba7b5ca5..6921ffdf26 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -213,7 +213,7 @@ static void __KernelMutexAcquireLock(PSPMutex *mutex, int count, SceUID thread) _dbg_assert_msg_((*iter).second != mutex->GetUID(), "Thread %d / mutex %d wasn't removed from mutexHeldLocks properly.", thread, mutex->GetUID()); #endif - mutexHeldLocks.insert(std::make_pair(thread, mutex->GetUID())); + mutexHeldLocks.emplace(thread, mutex->GetUID()); mutex->nm.lockLevel = count; mutex->nm.lockThread = thread; diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index ea9caaba1e..f717cd5a3e 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -230,7 +230,7 @@ public: MipsCallManager() : idGen_(0) {} u32 add(MipsCall *call) { u32 id = genId(); - calls_.insert(std::pair(id, call)); + calls_.emplace(id, call); return id; } MipsCall *get(u32 id) { diff --git a/Core/HW/Display.cpp b/Core/HW/Display.cpp index ebabb647d0..1dcb51e18c 100644 --- a/Core/HW/Display.cpp +++ b/Core/HW/Display.cpp @@ -265,7 +265,7 @@ void __DisplayListenVblank(VblankCallback callback) { void __DisplayListenFlip(FlipCallback callback, void *userdata) { std::lock_guard guard(listenersLock); - flipListeners.push_back(std::make_pair(callback, userdata)); + flipListeners.emplace_back(callback, userdata); } void __DisplayForgetFlip(FlipCallback callback, void *userdata) { diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index b85b336fcd..f5b11ca4a5 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -198,7 +198,7 @@ void JitBlockCache::ProxyBlock(u32 rootAddress, u32 startAddress, u32 size, cons // Make binary searches and stuff work ok b.normalEntry = codePtr; b.checkedEntry = codePtr; - proxyBlockMap_.insert(std::make_pair(startAddress, num_blocks_)); + proxyBlockMap_.emplace(startAddress, num_blocks_); AddBlockMap(num_blocks_); num_blocks_++; //commit the current block @@ -253,7 +253,7 @@ void JitBlockCache::FinalizeBlock(int block_num, bool block_link) { if (block_link) { for (int i = 0; i < MAX_JIT_BLOCK_EXITS; i++) { if (b.exitAddress[i] != INVALID_EXIT) { - links_to_.insert(std::make_pair(b.exitAddress[i], block_num)); + links_to_.emplace(b.exitAddress[i], block_num); } } diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 2b047a42b0..81f87da663 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -771,7 +771,7 @@ namespace MIPSAnalyst { for (auto iter = functions.begin(); iter != functions.end(); iter++) { AnalyzedFunction &f = *iter; if (f.hasHash && f.size > 16) { - hashToFunction.insert(std::make_pair(f.hash, &f)); + hashToFunction.emplace(f.hash, &f); } } } diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index ad02d603b4..2d8529f356 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -187,7 +187,7 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector &direct // Populate the default setting value. std::string section = StringFromFormat("%sSettingValue%d", info.section.c_str(), i + 1); if (!setting.name.empty() && g_Config.mPostShaderSetting.find(section) == g_Config.mPostShaderSetting.end()) { - g_Config.mPostShaderSetting.insert(std::pair(section, setting.value)); + g_Config.mPostShaderSetting.emplace(section, setting.value); } } diff --git a/GPU/Debugger/Breakpoints.cpp b/GPU/Debugger/Breakpoints.cpp index 97fbca57ee..6da92e41ae 100644 --- a/GPU/Debugger/Breakpoints.cpp +++ b/GPU/Debugger/Breakpoints.cpp @@ -339,7 +339,7 @@ void AddAddressBreakpoint(u32 addr, bool temp) { } else { // Remove the temporary marking. breakPCsTemp.erase(addr); - breakPCs.insert(std::make_pair(addr, BreakpointInfo{})); + breakPCs.emplace(addr, BreakpointInfo{}); } breakPCsCount = breakPCs.size(); diff --git a/GPU/Debugger/Debugger.cpp b/GPU/Debugger/Debugger.cpp index b505521631..fa55ec6b8e 100644 --- a/GPU/Debugger/Debugger.cpp +++ b/GPU/Debugger/Debugger.cpp @@ -219,9 +219,9 @@ bool SetRestrictPrims(const char *rule) { // If there's nothing yet, add everything else. if (updated.empty()) { if (range.first > 0) - updated.push_back(std::make_pair(0, range.first - 1)); + updated.emplace_back(0, range.first - 1); if (range.second < MAX_PRIMS) - updated.push_back(std::make_pair(range.second + 1, MAX_PRIMS)); + updated.emplace_back(range.second + 1, MAX_PRIMS); continue; } @@ -240,7 +240,7 @@ bool SetRestrictPrims(const char *rule) { // We're slicing a hole in this subrange. int next = sub.second; sub.second = range.first - 1; - updated.push_back(std::make_pair(range.second + 1, next)); + updated.emplace_back(range.second + 1, next); continue; } diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 3a620a4d91..6868b5d988 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -995,7 +995,7 @@ void ShaderManagerGLES::Load(const Path &filename) { if (!f.ReadArray(&fsid, 1)) { return; } - diskCachePending_.link.push_back(std::make_pair(vsid, fsid)); + diskCachePending_.link.emplace_back(vsid, fsid); } // Actual compilation happens in ContinuePrecompile(), called by GPU_GLES's IsReady. diff --git a/Windows/Debugger/CtrlMemView.cpp b/Windows/Debugger/CtrlMemView.cpp index 220ad0a99e..d40bdaf483 100644 --- a/Windows/Debugger/CtrlMemView.cpp +++ b/Windows/Debugger/CtrlMemView.cpp @@ -767,11 +767,11 @@ std::vector CtrlMemView::searchString(const std::string &searchQuery) { return searchResAddrs; std::vector> memoryAreas; - memoryAreas.push_back(std::pair(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd())); memoryAreas.reserve(3); + memoryAreas.emplace_back(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd()); // Ignore the video memory mirrors. - memoryAreas.push_back(std::pair(PSP_GetVidMemBase(), 0x04200000)); - memoryAreas.push_back(std::pair(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd())); + memoryAreas.emplace_back(PSP_GetVidMemBase(), 0x04200000); + memoryAreas.emplace_back(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd()); for (const auto &area : memoryAreas) { const u32 segmentStart = area.first; @@ -824,9 +824,9 @@ void CtrlMemView::search(bool continueSearch) std::vector> memoryAreas; memoryAreas.reserve(3); // Ignore the video memory mirrors. - memoryAreas.push_back(std::pair(PSP_GetVidMemBase(), 0x04200000)); - memoryAreas.push_back(std::pair(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd())); - memoryAreas.push_back(std::pair(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd())); + memoryAreas.emplace_back(PSP_GetVidMemBase(), 0x04200000); + memoryAreas.emplace_back(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd()); + memoryAreas.emplace_back(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd()); searching = true; redraw(); // so the cursor is disabled diff --git a/Windows/W32Util/ShellUtil.cpp b/Windows/W32Util/ShellUtil.cpp index 151cd643ce..bd53935d27 100644 --- a/Windows/W32Util/ShellUtil.cpp +++ b/Windows/W32Util/ShellUtil.cpp @@ -144,7 +144,7 @@ namespace W32Util files.push_back(directory); } else { while (*temp) { - files.push_back(directory + "\\" + ConvertWStringToUTF8(temp)); + files.emplace_back(directory + "\\" + ConvertWStringToUTF8(temp)); temp += wcslen(temp) + 1; } }