summaryrefslogtreecommitdiffstats
path: root/Source/cmExportSetMap.cxx
diff options
context:
space:
mode:
authorTushar Maheshwari <tushar27192@gmail.com>2019-09-06 10:16:02 (GMT)
committerTushar Maheshwari <tushar27192@gmail.com>2019-09-19 13:50:29 (GMT)
commit9b8a1f7c28deac892493b0a5548b08b2003238ea (patch)
tree72c22cba36879fded9bf99b94e75c2329281a048 /Source/cmExportSetMap.cxx
parentcca5897318d5c747078f79cd5bb45ba74955102a (diff)
downloadCMake-9b8a1f7c28deac892493b0a5548b08b2003238ea.zip
CMake-9b8a1f7c28deac892493b0a5548b08b2003238ea.tar.gz
CMake-9b8a1f7c28deac892493b0a5548b08b2003238ea.tar.bz2
cmExportSetMap: improve ownership of cmExportSet
- use `std::piecewise_construct` to fix gcc-4.8 build. - can use `emplace(name, name)` gcc-6 onwards.
Diffstat (limited to 'Source/cmExportSetMap.cxx')
-rw-r--r--Source/cmExportSetMap.cxx22
1 files changed, 4 insertions, 18 deletions
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
index 5c3f84f..68e76d5 100644
--- a/Source/cmExportSetMap.cxx
+++ b/Source/cmExportSetMap.cxx
@@ -2,30 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportSetMap.h"
-#include "cmAlgorithms.h"
-#include "cmExportSet.h"
-
+#include <tuple>
#include <utility>
-cmExportSet* cmExportSetMap::operator[](const std::string& name)
+cmExportSet& cmExportSetMap::operator[](const std::string& name)
{
auto it = this->find(name);
if (it == this->end()) // Export set not found
{
- it = this->insert(std::make_pair(name, new cmExportSet(name))).first;
+ auto tup_name = std::make_tuple(name);
+ it = this->emplace(std::piecewise_construct, tup_name, tup_name).first;
}
return it->second;
}
-
-void cmExportSetMap::clear()
-{
- cmDeleteAll(*this);
- this->derived::clear();
-}
-
-cmExportSetMap::cmExportSetMap() = default;
-
-cmExportSetMap::~cmExportSetMap()
-{
- this->clear();
-}