b-tree sequence
sequence container optimized for inserting/deleting in random places
|
Iterator template for const_iterator and iterator. More...
#include <btree_seq.h>
Public Types | |
typedef std::random_access_iterator_tag | iterator_category |
Random access iterator category. | |
typedef std::iterator < std::random_access_iterator_tag, TT >::value_type | value_type |
T or const T. | |
typedef std::iterator < std::random_access_iterator_tag, TT >::difference_type | difference_type |
ptrdiff_t (int). | |
typedef std::iterator < std::random_access_iterator_tag, TT >::reference | reference |
T& or const T&. | |
typedef std::iterator < std::random_access_iterator_tag, TT >::pointer | pointer |
T* or const T*. | |
Public Member Functions | |
iterator_base () | |
Default constructor. | |
iterator_base (const btree_seq *t, size_type pos) | |
Pointing to specific place in the tree. | |
iterator_base (const iterator_base &that) | |
Copy constructor for the same type. | |
template<typename T2 > | |
iterator_base (const iterator_base< T2 > &that) | |
Constructor for conversion from iterator to const_iterator. | |
iterator_base & | operator= (const iterator_base &that) |
Operator = for the same type. | |
template<typename T2 > | |
iterator_base & | operator= (const iterator_base< T2 > &that) |
Conversion from iterator to const_iterator. | |
reference | operator* () const |
Dereferencing. | |
pointer | operator-> () const |
Dereferencing. | |
reference | operator[] (difference_type n) const |
Getting arbitary element. | |
template<typename T2 > | |
bool | operator== (const iterator_base< T2 > &that) const |
Comparison. | |
template<typename T2 > | |
bool | operator!= (const iterator_base< T2 > &that) const |
Comparison. | |
template<typename T2 > | |
bool | operator> (const iterator_base< T2 > &that) const |
Comparison. | |
template<typename T2 > | |
bool | operator< (const iterator_base< T2 > &that) const |
Comparison. | |
template<typename T2 > | |
bool | operator>= (const iterator_base< T2 > &that) const |
Comparison. | |
template<typename T2 > | |
bool | operator<= (const iterator_base< T2 > &that) const |
Comparison. | |
template<typename T2 > | |
difference_type | operator- (const iterator_base< T2 > &that) const |
Comparison. | |
iterator_base & | operator++ () |
Preincrement. | |
iterator_base & | operator-- () |
Predecrement. | |
iterator_base | operator++ (int) |
Postincrement. | |
iterator_base | operator-- (int) |
Postdecrement. | |
iterator_base & | operator+= (difference_type n) |
Increase position by n. | |
iterator_base & | operator-= (difference_type n) |
Decrease position by n. | |
iterator_base | operator+ (difference_type n) const |
Increase position by n. | |
iterator_base | operator- (difference_type n) const |
Decrease position by n. | |
size_type | get_position () const |
Returns current position. | |
const btree_seq * | get_container () const |
Returns current container. | |
pointer | __get_null_pointer () const |
Returns null pointer. | |
Iterator template for const_iterator and iterator.
This is a lazy implementation of iterator. In other words, it takes constant time to construct, increment, decrement, get_position and relocate operations. When being dereferenced, it checks its validity and does actual work if necessary. So dereference operations (operators '*' '[]' '->') do most work and take from constant time to O(log(N)) time, depending on operation mode. If iterator is used in sequential mode (solely incrementing/decrementing), dereference operations require practically constant time amortized. If iterator is used in random access mode, dereference operations take O(log(N)) time and can be as expensive as sequence->operator[]. Hint: using function 'visit' might be faster than iterator. If you are modifying only one container at a time, using 'visit' might be preferable.