|
| iterator_range ()=default |
| Constructor of empty iterator_range. Both iterators are initialized to default (same) value. More...
|
|
constexpr | iterator_range (Iterator begin, Iterator end) |
| Constructor to make iterator_range from pair of iterators. More...
|
|
constexpr Iterator | begin () const |
| Accessor of the iterator to the begining. More...
|
|
constexpr Iterator | end () const |
| Accessor of the iterator to the end. More...
|
|
constexpr std::iterator_traits< Iterator >::reference | front () const |
| Getter of the first value in the iterator_range. More...
|
|
constexpr std::iterator_traits< Iterator >::reference | back () const |
| Getter of the last value in the iterator_range. More...
|
|
constexpr std::iterator_traits< Iterator >::reference | operator[] (typename std::iterator_traits< Iterator >::difference_type index) const |
| Array subscript operator implementation. More...
|
|
constexpr bool | empty () const |
| Test whether the iterator_range is empty. More...
|
|
constexpr size_t | size () const |
| Getter of the distance between begin and end iterators. More...
|
|
void | pop_front () |
| Advances the begin iterator. More...
|
|
void | pop_front (typename std::iterator_traits< Iterator >::difference_type n) |
| Advances the begin iterator n times. More...
|
|
void | pop_back () |
| Retracts the end iterator. More...
|
|
void | pop_back (typename std::iterator_traits< Iterator >::difference_type n) |
| Retracts the end iterator n times. More...
|
|
std::pair< iterator_range, iterator_range > | split (typename std::iterator_traits< Iterator >::difference_type index) const |
| Creates two sub ranges based on middle position. The element at the middle position is included in the second iterator_range. More...
|
|
iterator_range | slice (typename std::iterator_traits< Iterator >::difference_type start, typename std::iterator_traits< Iterator >::difference_type stop) const |
| Creates a subrange of the iterator_range representing interaval of values from start to stop . More...
|
|
iterator_range | slice (typename std::iterator_traits< Iterator >::difference_type start) const |
| Creates a subrange of the iterator_range representing interaval of values from start to the end of the iterator_range. More...
|
|
template<typename Iterator>
class ext::iterator_range< Iterator >
Implementation of iterator_range, i.e. pair of iterators. The class provides most notably begin and end methods to allow the class be used in foreach context.
- Template Parameters
-
Iterator | the type of wrapped pair of iterators |
template<typename Iterator >
Creates a subrange of the iterator_range representing interaval of values from start
to the end of the iterator_range.
If the start
is positive or zero, the actual cut position is calcuated relative to the begining of the iterator_range. If the start
is negative, the actual cut position is calculated relative to the end of the iterator_range.
The call is equivalent to slice ( begin, 0 ).
Example iterator_range ( 0, 1, 2, 3, 4, 5 ).slice ( 1 ) produces iterator_range ( 1, 2, 3, 4, 5 ); Example iterator_range ( 0, 1, 2, 3, 4, 5 ).slice ( -4 ) produces iterator_range ( 2, 3, 4, 5 );
- Parameters
-
start | the begin position of the resulting subrange |
- Returns
- subrange of the iterator_range.
template<typename Iterator >
iterator_range ext::iterator_range< Iterator >::slice |
( |
typename std::iterator_traits< Iterator >::difference_type |
start, |
|
|
typename std::iterator_traits< Iterator >::difference_type |
stop |
|
) |
| const |
|
inline |
Creates a subrange of the iterator_range representing interaval of values from start
to stop
.
If the start
is positive or zero, the actual cut position is calcuated relative to the begining of the iterator_range. If the start
is negative, the actual cut position is calculated relative to the end of the iterator_range.
If the end
is positive, the actual cut position is calcuated relative to the begining of the iterator_range. If the start
is negative or zero, the actual cut position is calculated relative to the end of the iterator_range.
Example iterator_range ( 0, 1, 2, 3, 4, 5 ).slice ( 1, 3 ) produces iterator_range ( 1, 2 ); Example iterator_range ( 0, 1, 2, 3, 4, 5 ).slice ( -4, -1 ) produces iterator_range ( 2, 3, 4 );
- Parameters
-
start | the begin position of the resulting subrange |
end | the end position of the resulting subrange |
- Returns
- subrange of the iterator_range.