summaryrefslogtreecommitdiffstats
path: root/Source/cmPropertyDefinitionMap.cxx
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-03-12 12:36:43 (GMT)
committerBrad King <brad.king@kitware.com>2020-03-13 14:24:51 (GMT)
commit73d52a862bfe73f591458b47a016b7400057ecab (patch)
treee15b631885a81ad58dcc7dd4435809d3e694ac49 /Source/cmPropertyDefinitionMap.cxx
parentf86d8009c6a4482c81221114a2b04b375564cc94 (diff)
downloadCMake-73d52a862bfe73f591458b47a016b7400057ecab.zip
CMake-73d52a862bfe73f591458b47a016b7400057ecab.tar.gz
CMake-73d52a862bfe73f591458b47a016b7400057ecab.tar.bz2
cmPropertyDefinition: Construct directly in defined state
Move `cmPropertyDefinitionMap::DefineProperty` functionality directly into the constructor to avoid an intermediate state.
Diffstat (limited to 'Source/cmPropertyDefinitionMap.cxx')
-rw-r--r--Source/cmPropertyDefinitionMap.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
index f752ed7..614d5a4 100644
--- a/Source/cmPropertyDefinitionMap.cxx
+++ b/Source/cmPropertyDefinitionMap.cxx
@@ -2,20 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmPropertyDefinitionMap.h"
+#include <tuple>
#include <utility>
-void cmPropertyDefinitionMap::DefineProperty(const std::string& name,
- cmProperty::ScopeType scope,
- const char* ShortDescription,
- const char* FullDescription,
- bool chain)
+void cmPropertyDefinitionMap::DefineProperty(
+ const std::string& name, cmProperty::ScopeType scope,
+ const std::string& ShortDescription, const std::string& FullDescription,
+ bool chain)
{
auto it = this->find(name);
- cmPropertyDefinition* prop;
if (it == this->end()) {
- prop = &(*this)[name];
- prop->DefineProperty(name, scope, ShortDescription, FullDescription,
- chain);
+ // try_emplace() since C++17
+ this->emplace(std::piecewise_construct, std::forward_as_tuple(name),
+ std::forward_as_tuple(name, scope, ShortDescription,
+ FullDescription, chain));
}
}