Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 7:10:56 PM (8 years ago)
Author:
muemart
Message:

Use emplace_back instead of push_back if beneficial

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r10916 r10918  
    102102                for (const auto& mapEntry : commands)
    103103                    if (groupIsVisible(mapEntry.second, bOnlyShowHidden) && mapEntry.first != "" && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0))
    104                         groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first)));
     104                        groupList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    105105
    106106                // now add all shortcuts (in group "")
     
    110110                    // add a line-break if the list isn't empty
    111111                    if (!groupList.empty())
    112                         groupList.push_back(ArgumentCompletionListElement("", "", "\n"));
     112                        groupList.emplace_back("", "", "\n");
    113113
    114114                    // add the shortcuts
    115115                    for (const auto& mapEntry : it_group->second)
    116116                        if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0))
    117                             groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first)));
     117                            groupList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    118118                }
    119119
     
    148148                    for (const auto& mapEntry : it_group->second)
    149149                        if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden)
    150                             commandList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first)));
     150                            commandList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    151151                }
    152152
     
    188188            {
    189189                ArgumentCompletionList list;
    190                 list.push_back(ArgumentCompletionListElement("", "", hint));
     190                list.emplace_back("", "", hint);
    191191                return list;
    192192            }
     
    261261                {
    262262                    if (boost::filesystem::is_directory(*file))
    263                         dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/'));
     263                        dirlist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/');
    264264                    else
    265                         filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF()));
     265                        filelist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF());
    266266                    ++file;
    267267                }
     
    282282            const std::set<std::string>& names = SettingsConfigFile::getInstance().getSectionNames();
    283283            for (const std::string& name : names)
    284                 sectionList.push_back(ArgumentCompletionListElement(name, getLowercase(name)));
     284                sectionList.emplace_back(name, getLowercase(name));
    285285
    286286            return sectionList;
     
    298298            SettingsConfigFile::ContainerMap::const_iterator upper = settings.getContainerUpperBound(sectionLC);
    299299            for (SettingsConfigFile::ContainerMap::const_iterator it = settings.getContainerLowerBound(sectionLC); it != upper; ++it)
    300                 entryList.push_back(ArgumentCompletionListElement(it->second.second->getName(), it->second.first));
     300                entryList.emplace_back(it->second.second->getName(), it->second.first);
    301301
    302302            return entryList;
     
    319319                {
    320320                    const std::string& valuestring = it->second.second->toString();
    321                     oldValue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
     321                    oldValue.emplace_back(valuestring, getLowercase(valuestring), "Old value: " + valuestring);
    322322                }
    323323            }
     
    335335
    336336            for (std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)
    337                 threads.push_back(ArgumentCompletionListElement(multi_cast<std::string>(*it)));
     337                threads.emplace_back(multi_cast<std::string>(*it));
    338338
    339339            return threads;
Note: See TracChangeset for help on using the changeset viewer.