From bd542748aff968854e4bdb92085f3d35d5d3e867 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 29 Nov 2024 16:13:45 -0500 Subject: [PATCH] find_package: Use map::emplace instead of make_pair Replace map::insert(make_pair(...) with map::emplace(...). This should be slightly more efficient, but also removes one of only two uses of std::pair. (Upcoming changes are going to remove the other, which will let us drop use of .) --- Source/cmFindPackageCommand.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 12bf160b9f..40790fe75c 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -549,14 +549,10 @@ void cmFindPackageCommand::AppendSearchPathGroups() PathLabel::SystemRegistry); // Create the new path objects - this->LabeledPaths.insert( - std::make_pair(PathLabel::PackageRedirect, cmSearchPath(this))); - this->LabeledPaths.insert( - std::make_pair(PathLabel::UserRegistry, cmSearchPath(this))); - this->LabeledPaths.insert( - std::make_pair(PathLabel::Builds, cmSearchPath(this))); - this->LabeledPaths.insert( - std::make_pair(PathLabel::SystemRegistry, cmSearchPath(this))); + this->LabeledPaths.emplace(PathLabel::PackageRedirect, cmSearchPath{ this }); + this->LabeledPaths.emplace(PathLabel::UserRegistry, cmSearchPath{ this }); + this->LabeledPaths.emplace(PathLabel::Builds, cmSearchPath{ this }); + this->LabeledPaths.emplace(PathLabel::SystemRegistry, cmSearchPath{ this }); } bool cmFindPackageCommand::InitialPass(std::vector const& args)