tlx
BTree< Key, Value, KeyOfValue, Compare, Traits, Duplicates, Allocator >::iterator Class Reference

STL-like iterator object for B+ tree items. More...

#include <btree.hpp>

Public Types

typedef BTree::key_type key_type
 The key type of the btree. Returned by key(). More...
 
typedef BTree::value_type value_type
 The value type of the btree. Returned by operator*(). More...
 
typedef value_typereference
 Reference to the value_type. STL required. More...
 
typedef value_typepointer
 Pointer to the value_type. STL required. More...
 
typedef std::bidirectional_iterator_tag iterator_category
 STL-magic iterator category. More...
 
typedef ptrdiff_t difference_type
 STL-magic. More...
 
typedef iterator self
 Our own type. More...
 

Public Member Functions

 iterator ()
 Default-Constructor of a mutable iterator. More...
 
 iterator (typename BTree::LeafNode *l, unsigned short s)
 Initializing-Constructor of a mutable iterator. More...
 
 iterator (const reverse_iterator &it)
 Copy-constructor from a reverse iterator. More...
 
reference operator* () const
 Dereference the iterator. More...
 
pointer operator-> () const
 Dereference the iterator. More...
 
const key_typekey () const
 Key of the current slot. More...
 
iteratoroperator++ ()
 Prefix++ advance the iterator to the next slot. More...
 
iterator operator++ (int)
 Postfix++ advance the iterator to the next slot. More...
 
iteratoroperator-- ()
 Prefix– backstep the iterator to the last slot. More...
 
iterator operator-- (int)
 Postfix– backstep the iterator to the last slot. More...
 
bool operator== (const iterator &x) const
 Equality of iterators. More...
 
bool operator!= (const iterator &x) const
 Inequality of iterators. More...
 

Private Attributes

BTree::LeafNodecurr_leaf
 The currently referenced leaf node of the tree. More...
 
unsigned short curr_slot
 Current key/data slot referenced. More...
 
 TLX_BTREE_FRIENDS
 

Friends

class const_iterator
 Friendly to the const_iterator, so it may access the two data items directly. More...
 
class reverse_iterator
 Also friendly to the reverse_iterator, so it may access the two data items directly. More...
 
class const_reverse_iterator
 Also friendly to the const_reverse_iterator, so it may access the two data items directly. More...
 
class BTree< key_type, value_type, key_of_value, key_compare, traits, allow_duplicates, allocator_type >
 Also friendly to the base btree class, because erase_iter() needs to read the curr_leaf and curr_slot values directly. More...
 

Detailed Description

template<typename Key, typename Value, typename KeyOfValue, typename Compare = std::less<Key>, typename Traits = btree_default_traits<Key, Value>, bool Duplicates = false, typename Allocator = std::allocator<Value>>
class tlx::BTree< Key, Value, KeyOfValue, Compare, Traits, Duplicates, Allocator >::iterator

STL-like iterator object for B+ tree items.

The iterator points to a specific slot number in a leaf.

Definition at line 341 of file btree.hpp.

Member Typedef Documentation

◆ difference_type

typedef ptrdiff_t difference_type

STL-magic.

Definition at line 362 of file btree.hpp.

◆ iterator_category

typedef std::bidirectional_iterator_tag iterator_category

STL-magic iterator category.

Definition at line 359 of file btree.hpp.

◆ key_type

The key type of the btree. Returned by key().

Definition at line 347 of file btree.hpp.

◆ pointer

typedef value_type* pointer

Pointer to the value_type. STL required.

Definition at line 356 of file btree.hpp.

◆ reference

Reference to the value_type. STL required.

Definition at line 353 of file btree.hpp.

◆ self

typedef iterator self

Our own type.

Definition at line 365 of file btree.hpp.

◆ value_type

The value type of the btree. Returned by operator*().

Definition at line 350 of file btree.hpp.

Constructor & Destructor Documentation

◆ iterator() [1/3]

iterator ( )
inline

Default-Constructor of a mutable iterator.

Definition at line 402 of file btree.hpp.

◆ iterator() [2/3]

iterator ( typename BTree::LeafNode l,
unsigned short  s 
)
inline

Initializing-Constructor of a mutable iterator.

Definition at line 407 of file btree.hpp.

◆ iterator() [3/3]

iterator ( const reverse_iterator it)
inline

Copy-constructor from a reverse iterator.

Definition at line 412 of file btree.hpp.

Member Function Documentation

◆ key()

const key_type& key ( ) const
inline

Key of the current slot.

Definition at line 427 of file btree.hpp.

◆ operator!=()

bool operator!= ( const iterator x) const
inline

Inequality of iterators.

Definition at line 509 of file btree.hpp.

◆ operator*()

reference operator* ( ) const
inline

Dereference the iterator.

Definition at line 417 of file btree.hpp.

◆ operator++() [1/2]

iterator& operator++ ( )
inline

Prefix++ advance the iterator to the next slot.

Definition at line 432 of file btree.hpp.

◆ operator++() [2/2]

iterator operator++ ( int  )
inline

Postfix++ advance the iterator to the next slot.

Definition at line 449 of file btree.hpp.

◆ operator--() [1/2]

iterator& operator-- ( )
inline

Prefix– backstep the iterator to the last slot.

Definition at line 468 of file btree.hpp.

◆ operator--() [2/2]

iterator operator-- ( int  )
inline

Postfix– backstep the iterator to the last slot.

Definition at line 485 of file btree.hpp.

◆ operator->()

pointer operator-> ( ) const
inline

Dereference the iterator.

Definition at line 422 of file btree.hpp.

◆ operator==()

bool operator== ( const iterator x) const
inline

Equality of iterators.

Definition at line 504 of file btree.hpp.

Friends And Related Function Documentation

◆ BTree< key_type, value_type, key_of_value, key_compare, traits, allow_duplicates, allocator_type >

Also friendly to the base btree class, because erase_iter() needs to read the curr_leaf and curr_slot values directly.

Definition at line 391 of file btree.hpp.

◆ const_iterator

friend class const_iterator
friend

Friendly to the const_iterator, so it may access the two data items directly.

Definition at line 378 of file btree.hpp.

◆ const_reverse_iterator

friend class const_reverse_iterator
friend

Also friendly to the const_reverse_iterator, so it may access the two data items directly.

Definition at line 386 of file btree.hpp.

◆ reverse_iterator

friend class reverse_iterator
friend

Also friendly to the reverse_iterator, so it may access the two data items directly.

Definition at line 382 of file btree.hpp.

Member Data Documentation

◆ curr_leaf

BTree::LeafNode* curr_leaf
private

The currently referenced leaf node of the tree.

Definition at line 371 of file btree.hpp.

◆ curr_slot

unsigned short curr_slot
private

Current key/data slot referenced.

Definition at line 374 of file btree.hpp.

◆ TLX_BTREE_FRIENDS

TLX_BTREE_FRIENDS
private

Definition at line 396 of file btree.hpp.


The documentation for this class was generated from the following file: