Merge pull request #2013 from lioncash/emplace

Use emplace_* functions where in-place construction is preferable
This commit is contained in:
Markus Wick 2015-02-04 17:46:07 +01:00
commit 235fa05171
12 changed files with 18 additions and 18 deletions

View File

@ -203,7 +203,7 @@ IniFile::Section* IniFile::GetOrCreateSection(const std::string& sectionName)
Section* section = GetSection(sectionName);
if (!section)
{
sections.push_back(Section(sectionName));
sections.emplace_back(sectionName);
section = &sections.back();
}
return section;

View File

@ -101,7 +101,7 @@ void ReadReplacements(replace_v& replacements)
std::string replacement;
while (f >> letter >> replacement && replacement.size())
replacements.push_back(std::make_pair(letter, replacement));
replacements.emplace_back(letter, replacement);
}
}

View File

@ -33,7 +33,7 @@ void LabelMap::RegisterLabel(const std::string &label, u16 lval, LabelType type)
label.c_str(), lval, old_value);
DeleteLabel(label);
}
labels.push_back(label_t(label, lval, type));
labels.emplace_back(label, lval, type);
}
void LabelMap::DeleteLabel(const std::string &label)

View File

@ -434,7 +434,7 @@ inline s32 GCMemcardDirectory::SaveAreaRW(u32 block, bool writing)
int num_blocks = BE16(m_saves[i].m_gci_header.BlockCount);
while (num_blocks)
{
m_saves[i].m_save_data.push_back(GCMBlock());
m_saves[i].m_save_data.emplace_back();
num_blocks--;
}
}

View File

@ -186,7 +186,7 @@ namespace JitILProfiler
static Block& Add(u64 codeHash)
{
const u32 _blockIndex = (u32)blocks.size();
blocks.push_back(Block());
blocks.emplace_back();
Block& block = blocks.back();
block.index = _blockIndex;
block.codeHash = codeHash;

View File

@ -153,7 +153,7 @@ namespace JitInterface
u64 timecost = block->ticCounter;
// Todo: tweak.
if (block->runCount >= 1)
stats.push_back(BlockStat(i, cost));
stats.emplace_back(i, cost);
cost_sum += cost;
timecost_sum += timecost;
}

View File

@ -175,7 +175,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size)
if (target != INVALID_TARGET && instr.LK)
{
//we found a branch-n-link!
func.calls.push_back(SCall(target,addr));
func.calls.emplace_back(target, addr);
func.flags &= ~FFLAG_LEAF;
}
}

View File

@ -113,7 +113,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
u32 addr = std::stoul(pieces[0], nullptr, 16);
u32 value = std::stoul(pieces[1], nullptr, 16);
decryptedLines.push_back(ActionReplay::AREntry(addr, value));
decryptedLines.emplace_back(addr, value);
continue;
}
else if (pieces.size() == 1)

View File

@ -48,7 +48,7 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
if (_selection == -1)
{
tempEntries.clear();
tempEntries.push_back(PatchEngine::PatchEntry(PatchEngine::PATCH_8BIT, 0x00000000, 0x00000000));
tempEntries.emplace_back(PatchEngine::PATCH_8BIT, 0x00000000, 0x00000000);
}
else
{

View File

@ -128,9 +128,7 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHe
if (m_virtualXFBList.size() < MAX_VIRTUAL_XFB)
{
// create a new Virtual XFB and place it at the front of the list
VirtualXFB v;
memset(&v, 0, sizeof v);
m_virtualXFBList.push_front(v);
m_virtualXFBList.emplace_front();
vxfb = m_virtualXFBList.begin();
}
else

View File

@ -57,14 +57,16 @@ public:
protected:
struct VirtualXFB
{
VirtualXFB() : xfbSource(nullptr) {}
VirtualXFB()
{
}
// Address and size in GameCube RAM
u32 xfbAddr;
u32 xfbWidth;
u32 xfbHeight;
u32 xfbAddr = 0;
u32 xfbWidth = 0;
u32 xfbHeight = 0;
XFBSourceBase *xfbSource;
XFBSourceBase* xfbSource = nullptr;
};
typedef std::list<VirtualXFB> VirtualXFBListType;

View File

@ -129,7 +129,7 @@ void PostProcessingShaderConfiguration::LoadOptions(const std::string& code)
IniFile::ParseLine(line, &key, &value);
if (!(key == "" && value == ""))
current_strings->m_options.push_back(std::make_pair(key, value));
current_strings->m_options.emplace_back(key, value);
}
}
}