Skip to content

Commit

Permalink
Merge pull request #11772 from wmtan/Avoid_const_cast
Browse files Browse the repository at this point in the history
get rid of const_cast
  • Loading branch information
cmsbuild committed Oct 14, 2015
2 parents f190bfc + b70dedd commit 23fc7e2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions DataFormats/Provenance/src/BranchChildren.cc
Expand Up @@ -3,14 +3,15 @@
namespace edm {
void
BranchChildren::append_(map_t const& lookup, BranchID item, BranchIDSet& itemSet) const {
BranchIDSet const& items = const_cast<map_t &>(lookup)[item];
// For each parent(child)
for (BranchIDSet::const_iterator ci = items.begin(), ce = items.end();
ci != ce; ++ci) {
// Insert the BranchID of the parents(children) into the set of ancestors(descendants).
// If the insert succeeds, append recursively.
if (itemSet.insert(*ci).second) {
append_(lookup, *ci, itemSet);
auto const iter = lookup.find(item);
if(iter != lookup.end()) {
BranchIDSet const& branchIDs = iter->second;
for(BranchID const& branchID : branchIDs) {
// Insert the BranchID of the parents(children) into the set of ancestors(descendants).
// If the insert succeeds, append recursively.
if(itemSet.insert(branchID).second) {
append_(lookup, branchID, itemSet);
}
}
}
}
Expand Down

0 comments on commit 23fc7e2

Please sign in to comment.