Project

General

Profile

Task #2155

NameTree: enumeration with range-based for

Added by Junxiao Shi almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tables
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
1.50 h

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 issues

Related to NFD - Task #2100: Simplify tables with C++11 featuresClosedJunxiao Shi

Actions
#1

Updated by Junxiao Shi almost 7 years ago

  • Related to Task #2100: Simplify tables with C++11 features added
#2

Updated by Junxiao Shi almost 7 years ago

  • Status changed from New to In Progress
#3

Updated by Junxiao Shi almost 7 years ago

  • % Done changed from 0 to 50

findAllMatches: http://gerrit.named-data.net/1440

The next Change will modify remaining two methods.

#4

Updated by Junxiao Shi almost 7 years ago

  • 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.

#5

Updated by Junxiao Shi almost 7 years ago

  • 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.

#6

Updated by Junxiao Shi almost 7 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 80 to 100

Change NameTree::Range to boost::iterator_range: http://gerrit.named-data.net/1504

#7

Updated by Junxiao Shi almost 7 years ago

  • Status changed from Code review to Closed

Also available in: Atom PDF