Task #2155
closed
NameTree: enumeration with range-based for
Added by Junxiao Shi about 10 years ago.
Updated almost 10 years ago.
Description
Modify NameTree enumeration functions, so that they can be used with range-based for.
The new API shall support the following snippets:
NameTree nt;
auto&& fullEnumerated = nt.fullEnumerate(...);
for (const name_tree::Entry& nte : fullEnumerated) {
...
}
auto&& partialEnumerated = nt.partialEnumerate(...);
for (const name_tree::Entry& nte : partialEnumerated) {
...
}
auto&& allMatches = nt.findAllMatches(...);
for (const name_tree::Entry& nte : allMatches) {
...
}
- Related to Task #2100: Simplify tables with C++11 features added
- Status changed from New to In Progress
- % Done changed from 0 to 50
- Status changed from In Progress to Code review
- % Done changed from 50 to 100
fullEnumerate
partialEnumerate
http://gerrit.named-data.net/1475
I know Fib::removeNextHopFromAllEntries
isn't so pretty after this change, but the previous code is also not pretty.
Some helper method that wraps "advance iterator before erasing" logic could simplify this, but I'd leave this for a future commit.
- Status changed from Code review to In Progress
- % Done changed from 100 to 80
I'll change NameTree::Range
to either boost::iterator_range
or boost::sub_range
in the next commit.
- Status changed from In Progress to Code review
- % Done changed from 80 to 100
- Status changed from Code review to Closed
Also available in: Atom
PDF