Project

General

Profile

Actions

Task #2155

closed

NameTree: enumeration with range-based for

Added by Junxiao Shi over 9 years ago. Updated over 9 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 1 (0 open1 closed)

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

Actions
Actions #1

Updated by Junxiao Shi over 9 years ago

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

Updated by Junxiao Shi over 9 years ago

  • Status changed from New to In Progress
Actions #3

Updated by Junxiao Shi over 9 years ago

  • % Done changed from 0 to 50

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

The next Change will modify remaining two methods.

Actions #4

Updated by Junxiao Shi over 9 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.

Actions #5

Updated by Junxiao Shi over 9 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.

Actions #6

Updated by Junxiao Shi over 9 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

Actions #7

Updated by Junxiao Shi over 9 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF