diff options
author | Leonid Pospelov <pospelovlm@yandex.ru> | 2019-04-12 15:19:58 (GMT) |
---|---|---|
committer | Leonid Pospelov <pospelovlm@yandex.ru> | 2019-04-12 15:20:07 (GMT) |
commit | 2418a5aec0cad5cfd23fdb82ac6e11aa2a20a63e (patch) | |
tree | b4a8d28462118afb3889e95ed0343c76b5819a83 /Source | |
parent | db6fdfdb053a372382ff8eadad9bfa47c1a3b4bc (diff) | |
download | CMake-2418a5aec0cad5cfd23fdb82ac6e11aa2a20a63e.zip CMake-2418a5aec0cad5cfd23fdb82ac6e11aa2a20a63e.tar.gz CMake-2418a5aec0cad5cfd23fdb82ac6e11aa2a20a63e.tar.bz2 |
cmVisualStudio10TargetGenerator: Remove uses of const_cast
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 20 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 2 |
2 files changed, 10 insertions, 12 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5195957..1b72ac3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1449,7 +1449,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::vector<cmGeneratorTarget::AllConfigSource> const& sources = this->GeneratorTarget->GetAllConfigSources(); - std::set<cmSourceGroup*> groupsUsed; + std::set<cmSourceGroup const*> groupsUsed; for (cmGeneratorTarget::AllConfigSource const& si : sources) { std::string const& source = si.Source->GetFullPath(); cmSourceGroup* sourceGroup = @@ -1534,13 +1534,13 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { Elem e1(e0, "ItemGroup"); e1.SetHasElements(); - std::vector<cmSourceGroup*> groupsVec(groupsUsed.begin(), - groupsUsed.end()); + std::vector<cmSourceGroup const*> groupsVec(groupsUsed.begin(), + groupsUsed.end()); std::sort(groupsVec.begin(), groupsVec.end(), - [](cmSourceGroup* l, cmSourceGroup* r) { + [](cmSourceGroup const* l, cmSourceGroup const* r) { return l->GetFullName() < r->GetFullName(); }); - for (cmSourceGroup* sg : groupsVec) { + for (cmSourceGroup const* sg : groupsVec) { std::string const& name = sg->GetFullName(); if (!name.empty()) { std::string guidName = "SG_Filter_" + name; @@ -1572,7 +1572,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() // Add to groupsUsed empty source groups that have non-empty children. void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( - std::set<cmSourceGroup*>& groupsUsed, + std::set<cmSourceGroup const*>& groupsUsed, const std::vector<cmSourceGroup>& allGroups) { for (cmSourceGroup const& current : allGroups) { @@ -1583,8 +1583,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( this->AddMissingSourceGroups(groupsUsed, children); - cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(¤t); - if (groupsUsed.find(current_ptr) != groupsUsed.end()) { + if (groupsUsed.find(¤t) != groupsUsed.end()) { continue; // group has already been added to set } @@ -1592,8 +1591,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( // (at least one child must already have been added) std::vector<cmSourceGroup>::const_iterator child_it = children.begin(); while (child_it != children.end()) { - cmSourceGroup* child_ptr = const_cast<cmSourceGroup*>(&(*child_it)); - if (groupsUsed.find(child_ptr) != groupsUsed.end()) { + if (groupsUsed.find(&(*child_it)) != groupsUsed.end()) { break; // found a child that was already added => add current group too } child_it++; @@ -1603,7 +1601,7 @@ void cmVisualStudio10TargetGenerator::AddMissingSourceGroups( continue; // no descendants have source files => ignore this group } - groupsUsed.insert(current_ptr); + groupsUsed.insert(¤t); } } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 5901004..6a1ee1d 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -165,7 +165,7 @@ private: void WriteGroupSources(Elem& e0, std::string const& name, ToolSources const& sources, std::vector<cmSourceGroup>&); - void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed, + void AddMissingSourceGroups(std::set<cmSourceGroup const*>& groupsUsed, const std::vector<cmSourceGroup>& allGroups); bool IsResxHeader(const std::string& headerFile); bool IsXamlHeader(const std::string& headerFile); |