Project

General

Profile

Feature #2998

Updated by Junxiao Shi almost 9 years ago

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

     element_iterator 
     insert(element_const_iterator insert(element_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`](http://stackoverflow.com/a/3629059/3729203).   
 Compiler-feature detection should be performed to detect the necessity of this trick; this trick shall be wrapped in `#ifdef`.

Back