mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
cmGlobalGenerator: Use transparent comparator to avoid string copies
This commit is contained in:
committed by
Brad King
parent
9a575a835f
commit
6ed75b1fe6
@@ -1111,7 +1111,11 @@ std::string cmGlobalGenerator::GetLanguageFromExtension(
|
||||
if (ext.front() == '.') {
|
||||
ext = ext.substr(1);
|
||||
}
|
||||
#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
|
||||
auto const it = this->ExtensionToLanguage.find(ext);
|
||||
#else
|
||||
auto const it = this->ExtensionToLanguage.find(std::string(ext));
|
||||
#endif
|
||||
if (it != this->ExtensionToLanguage.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -872,7 +873,11 @@ private:
|
||||
std::set<std::string> LanguagesInProgress;
|
||||
std::map<std::string, std::string> OutputExtensions;
|
||||
std::map<std::string, std::string> LanguageToOutputExtension;
|
||||
#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
|
||||
std::map<std::string, std::string, std::less<void>> ExtensionToLanguage;
|
||||
#else
|
||||
std::map<std::string, std::string> ExtensionToLanguage;
|
||||
#endif
|
||||
std::map<std::string, int> LanguageToLinkerPreference;
|
||||
|
||||
#if !defined(CMAKE_BOOTSTRAP)
|
||||
|
||||
Reference in New Issue
Block a user