Thrill  0.1
guarded_iterator< RandomAccessIterator, Comparator > Class Template Reference

Detailed Description

template<typename RandomAccessIterator, typename Comparator>
class tlx::multiway_merge_detail::guarded_iterator< RandomAccessIterator, Comparator >

Iterator wrapper supporting an implicit supremum at the end of the sequence, dominating all comparisons.

Deriving from RandomAccessIterator is not possible since RandomAccessIterator need not be a class.

Definition at line 54 of file multiway_merge.hpp.

#include <multiway_merge.hpp>

Public Types

using self_type = guarded_iterator< RandomAccessIterator, Comparator >
 Our own type. More...
 
using value_type = typename std::iterator_traits< RandomAccessIterator >::value_type
 Value type of the iterator. More...
 

Public Member Functions

 guarded_iterator (RandomAccessIterator begin, RandomAccessIterator end, Comparator &comp)
 Constructor. More...
 
RandomAccessIterator & iterator ()
 Convert to wrapped iterator. More...
 
value_typeoperator* ()
 Dereference operator. More...
 
self_typeoperator++ ()
 Pre-increment operator. More...
 

Protected Attributes

Comparator & comp_
 Comparator. More...
 
RandomAccessIterator current
 Current iterator position. More...
 
RandomAccessIterator end_
 End iterator of the sequence. More...
 

Friends

bool operator< (self_type &bi1, self_type &bi2)
 Compare two elements referenced by guarded iterators. More...
 
bool operator<= (self_type &bi1, self_type &bi2)
 Compare two elements referenced by guarded iterators. More...
 

Member Typedef Documentation

◆ self_type

using self_type = guarded_iterator<RandomAccessIterator, Comparator>

Our own type.

Definition at line 58 of file multiway_merge.hpp.

◆ value_type

using value_type = typename std::iterator_traits<RandomAccessIterator>::value_type

Value type of the iterator.

Definition at line 62 of file multiway_merge.hpp.

Constructor & Destructor Documentation

◆ guarded_iterator()

guarded_iterator ( RandomAccessIterator  begin,
RandomAccessIterator  end,
Comparator &  comp 
)
inline

Constructor.

Sets iterator to beginning of sequence.

Parameters
beginBegin iterator of sequence.
endEnd iterator of sequence.
compComparator provided for associated overloaded compare operators.

Definition at line 80 of file multiway_merge.hpp.

Member Function Documentation

◆ iterator()

RandomAccessIterator& iterator ( )
inline

Convert to wrapped iterator.

Returns
Wrapped iterator.

Definition at line 106 of file multiway_merge.hpp.

References guarded_iterator< RandomAccessIterator, Comparator >::current.

Referenced by tlx::multiway_merge_detail::multiway_merge_3_combined().

◆ operator*()

value_type& operator* ( )
inline

Dereference operator.

Returns
Referenced element.

Definition at line 98 of file multiway_merge.hpp.

References guarded_iterator< RandomAccessIterator, Comparator >::current.

◆ operator++()

self_type& operator++ ( )
inline

Pre-increment operator.

Returns
This.

Definition at line 89 of file multiway_merge.hpp.

References guarded_iterator< RandomAccessIterator, Comparator >::current.

Friends And Related Function Documentation

◆ operator<

bool operator< ( self_type bi1,
self_type bi2 
)
friend

Compare two elements referenced by guarded iterators.

Parameters
bi1First iterator.
bi2Second iterator.
Returns
True if less.

Definition at line 116 of file multiway_merge.hpp.

◆ operator<=

bool operator<= ( self_type bi1,
self_type bi2 
)
friend

Compare two elements referenced by guarded iterators.

Parameters
bi1First iterator.
bi2Second iterator.
Returns
True if less equal.

Definition at line 130 of file multiway_merge.hpp.

Member Data Documentation

◆ comp_

Comparator& comp_
protected

Comparator.

Definition at line 70 of file multiway_merge.hpp.

◆ current

◆ end_

RandomAccessIterator end_
protected

End iterator of the sequence.

Definition at line 68 of file multiway_merge.hpp.


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