using emplace

This commit is contained in:
caheckman 2021-01-07 14:36:10 -05:00
parent 3644c120c0
commit 5f715d73e3
34 changed files with 101 additions and 103 deletions

View file

@ -193,7 +193,7 @@ CPoolRecord *ConstantPoolInternal::createRecord(const vector<uintb> &refs)
{
CheapSorter sorter(refs);
pair<map<CheapSorter,CPoolRecord>::iterator,bool> res;
res = cpoolMap.insert(pair<CheapSorter,CPoolRecord>(sorter,CPoolRecord()));
res = cpoolMap.emplace(piecewise_construct,forward_as_tuple(sorter),forward_as_tuple());
if (res.second == false)
throw LowlevelError("Creating duplicate entry in constant pool: "+(*res.first).second.getToken());
return &(*res.first).second;