Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of const_cast #11772

Merged
merged 1 commit into from Oct 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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