Project

General

Profile

Actions

Feature #2998

closed

Block::insert and Block::erase

Added by Junxiao Shi over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Base
Target version:
Start date:
07/07/2015
Due date:
% Done:

100%

Estimated time:
1.50 h

Description

In Block abstraction, allow inserting an element at a specified position.

element_iterator
insert(element_const_iterator pos, const Block& element);

Change the parameter type and return type of Block::erase from element_iterator to element_const_iterator.

Parameter type is element_const_iterator, because both find and elements_begin return element_const_iterator, so that the caller is unable to obtain a element_iterator.
Using element_const_iterator is also consistent with C++11 APIs.

std::vector<..>::insert and std::vector<..>::erase installed with gcc46 on Ubuntu 12.04 does not take const_iterator.

This problem can be solved by internally converting from elements_const_iterator to elements_iterator with std::advance.

Compiler-feature detection should be performed to detect the necessity of this trick; this trick shall be wrapped in #ifdef.


Related issues 1 (0 open1 closed)

Blocks ndn-cxx - Feature #2879: NDNLPv2: Packet and FieldsClosedEric Newberry06/10/2015

Actions
Actions

Also available in: Atom PDF