tlx
Loading...
Searching...
No Matches
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().
 
typedef BTree::value_type value_type
 The value type of the btree. Returned by operator*().
 
typedef value_typereference
 Reference to the value_type. STL required.
 
typedef value_typepointer
 Pointer to the value_type. STL required.
 
typedef std::bidirectional_iterator_tag iterator_category
 STL-magic iterator category.
 
typedef ptrdiff_t difference_type
 STL-magic.
 
typedef iterator self
 Our own type.
 

Public Member Functions

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

Private Attributes

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

Friends

class const_iterator
 Friendly to the const_iterator, so it may access the two data items directly.
 
class reverse_iterator
 Also friendly to the reverse_iterator, so it may access the two data items directly.
 
class const_reverse_iterator
 Also friendly to the const_reverse_iterator, so it may access the two data items directly.
 
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.
 

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 333 of file btree.hpp.

Member Typedef Documentation

◆ difference_type

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>>
typedef ptrdiff_t difference_type

STL-magic.

Definition at line 354 of file btree.hpp.

◆ iterator_category

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>>
typedef std::bidirectional_iterator_tag iterator_category

STL-magic iterator category.

Definition at line 351 of file btree.hpp.

◆ key_type

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>>
typedef BTree::key_type key_type

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

Definition at line 339 of file btree.hpp.

◆ pointer

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>>
typedef value_type* pointer

Pointer to the value_type. STL required.

Definition at line 348 of file btree.hpp.

◆ reference

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>>
typedef value_type& reference

Reference to the value_type. STL required.

Definition at line 345 of file btree.hpp.

◆ self

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>>
typedef iterator self

Our own type.

Definition at line 357 of file btree.hpp.

◆ value_type

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>>
typedef BTree::value_type value_type

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

Definition at line 342 of file btree.hpp.

Constructor & Destructor Documentation

◆ iterator() [1/3]

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>>
iterator ( )
inline

Default-Constructor of a mutable iterator.

Definition at line 394 of file btree.hpp.

◆ iterator() [2/3]

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>>
iterator ( typename BTree::LeafNode l,
unsigned short  s 
)
inline

Initializing-Constructor of a mutable iterator.

Definition at line 399 of file btree.hpp.

◆ iterator() [3/3]

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>>
iterator ( const reverse_iterator it)
inline

Copy-constructor from a reverse iterator.

Definition at line 404 of file btree.hpp.

Member Function Documentation

◆ key()

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>>
const key_type & key ( ) const
inline

Key of the current slot.

Definition at line 419 of file btree.hpp.

◆ operator!=()

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>>
bool operator!= ( const iterator x) const
inline

Inequality of iterators.

Definition at line 501 of file btree.hpp.

◆ operator*()

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>>
reference operator* ( ) const
inline

Dereference the iterator.

Definition at line 409 of file btree.hpp.

◆ operator++() [1/2]

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>>
iterator & operator++ ( )
inline

Prefix++ advance the iterator to the next slot.

Definition at line 424 of file btree.hpp.

◆ operator++() [2/2]

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>>
iterator operator++ ( int  )
inline

Postfix++ advance the iterator to the next slot.

Definition at line 441 of file btree.hpp.

◆ operator--() [1/2]

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>>
iterator & operator-- ( )
inline

Prefix– backstep the iterator to the last slot.

Definition at line 460 of file btree.hpp.

◆ operator--() [2/2]

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>>
iterator operator-- ( int  )
inline

Postfix– backstep the iterator to the last slot.

Definition at line 477 of file btree.hpp.

◆ operator->()

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>>
pointer operator-> ( ) const
inline

Dereference the iterator.

Definition at line 414 of file btree.hpp.

◆ operator==()

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>>
bool operator== ( const iterator x) const
inline

Equality of iterators.

Definition at line 496 of file btree.hpp.

Friends And Related Symbol Documentation

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

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>>
friend class BTree< key_type, value_type, key_of_value, key_compare, traits, allow_duplicates, allocator_type >
friend

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

Definition at line 378 of file btree.hpp.

◆ const_iterator

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>>
friend class const_iterator
friend

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

Definition at line 370 of file btree.hpp.

◆ const_reverse_iterator

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>>
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 378 of file btree.hpp.

◆ reverse_iterator

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>>
friend class reverse_iterator
friend

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

Definition at line 374 of file btree.hpp.

Member Data Documentation

◆ curr_leaf

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>>
BTree::LeafNode* curr_leaf
private

The currently referenced leaf node of the tree.

Definition at line 363 of file btree.hpp.

◆ curr_slot

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>>
unsigned short curr_slot
private

Current key/data slot referenced.

Definition at line 366 of file btree.hpp.

◆ TLX_BTREE_FRIENDS

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>>
TLX_BTREE_FRIENDS
private

Definition at line 388 of file btree.hpp.


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