Stride Reference Manual  - generated for commit 9643b11
stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator > Class Template Reference

Implementation of iterator for SegmentedVector. More...

#include <SVIterator.h>

Collaboration diagram for stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >:
Collaboration graph

Public Types

using iterator_category = std::random_access_iterator_tag
 
using value_type = T
 
using difference_type = std::ptrdiff_t
 
using pointer = P
 
using reference = R
 
using self_type = SVIterator< T, N, Safe, P, R, is_const_iterator >
 

Public Member Functions

 SVIterator ()
 Default constructor. More...
 
 SVIterator (const self_type &other)
 Copy constructor. More...
 
operator* () const
 Element access. More...
 
operator-> () const
 Member of element access. More...
 
self_typeoperator++ ()
 Pre-increment (returns position after increment) More...
 
const self_type operator++ (int)
 Post-increment (returns position prior to increment) More...
 
self_typeoperator-- ()
 Pre-decrement (returns position after decrement) More...
 
const self_type operator-- (int)
 Pre-increment (returns position after decrement) More...
 
bool operator== (const self_type &other) const
 Iterator equality. More...
 
bool operator!= (const self_type &other) const
 Iterator inequality. More...
 
operator[] (std::size_t n) const
 Direct access to n-th element. More...
 
self_typeoperator+= (std::ptrdiff_t n)
 Set iterator to n-th next element. More...
 
self_typeoperator-= (std::ptrdiff_t n)
 Set iterator to n-th previous element. More...
 
self_type operator+ (std::ptrdiff_t n)
 Return iterator pointing to n-th next element. More...
 
self_type operator- (std::ptrdiff_t n)
 Return iterator pointing to n-th previous element. More...
 
long int operator- (const self_type &other) const
 Return distance between iterators. More...
 
bool operator< (const self_type &other) const
 Returns whether iterator is before other. More...
 
bool operator<= (const self_type &other) const
 Returns whether iterator is not after other. More...
 
bool operator> (const self_type &other) const
 Returns whether iterator is after other. More...
 
bool operator>= (const self_type &other) const
 Returns whether iterator is not after other. More...
 

Private Types

using container_pointer_type = typename std::conditional< is_const_iterator, const SegmentedVector< T, N, Safe > *, SegmentedVector< T, N, Safe > * >::type
 Type of pointer-to-container (i.e. its const qualification). More...
 

Private Member Functions

 SVIterator (std::size_t p, container_pointer_type c)
 Private constructor, currently only container itself can create iterators. More...
 

Private Attributes

std::size_t m_p
 Current iterator position in the container. More...
 
container_pointer_type m_c
 Container that the iterator points into. More...
 

Friends

class SegmentedVector< T, N, Safe >
 

Detailed Description

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
class stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >

Implementation of iterator for SegmentedVector.

It will provide both const and non-const iterators.

Possible states for the iterator are: (a) Default constructed: m_c == nullptr && m_p == 0. This is the singular state in which the iterator can be assigned, but not incremented or compared. (b) Past-the-end: m_c != nullptr && m_p == m_c->size(). The iterator cannot be dereferenced. (c) Dereferencable: m_c != nullptr && m_p < mc->size(). Notice that m_p is of type size_t and hence always non-negative. Thus the above reuires !m_c->empty().

Template parameters: T value type of iterator and of its container. N block size of its container P pointer-to-T type (can be const qualified). R reference-to-T type (can be const qualified). is_const_iterator to make it a const_iterator

Definition at line 57 of file SVIterator.h.

Member Typedef Documentation

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
using stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::iterator_category = std::random_access_iterator_tag

Definition at line 61 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
using stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::value_type = T

Definition at line 62 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
using stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::difference_type = std::ptrdiff_t

Definition at line 63 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
using stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::pointer = P

Definition at line 64 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
using stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::reference = R

Definition at line 65 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
using stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::self_type = SVIterator<T, N, Safe, P, R, is_const_iterator>

Definition at line 73 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
using stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::container_pointer_type = typename std::conditional<is_const_iterator, const SegmentedVector<T, N, Safe>*, SegmentedVector<T, N, Safe>*>::type
private

Type of pointer-to-container (i.e. its const qualification).

Definition at line 237 of file SVIterator.h.

Constructor & Destructor Documentation

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::SVIterator ( )
inline

Default constructor.

Definition at line 79 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::SVIterator ( const self_type other)
inline

Copy constructor.

Definition at line 82 of file SVIterator.h.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::SVIterator ( std::size_t  p,
container_pointer_type  c 
)
inlineprivate

Private constructor, currently only container itself can create iterators.

Definition at line 241 of file SVIterator.h.

Member Function Documentation

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
R stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator* ( ) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
P stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator-> ( ) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
self_type& stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator++ ( )
inline

Pre-increment (returns position after increment)

Definition at line 104 of file SVIterator.h.

References stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_c, and stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_p.

Referenced by stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator++().

Here is the caller graph for this function:

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
const self_type stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator++ ( int  )
inline

Post-increment (returns position prior to increment)

Definition at line 114 of file SVIterator.h.

References stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator++().

Here is the call graph for this function:

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
self_type& stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator-- ( )
inline

Pre-decrement (returns position after decrement)

Definition at line 122 of file SVIterator.h.

References stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_c, and stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_p.

Referenced by stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator--().

Here is the caller graph for this function:

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
const self_type stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator-- ( int  )
inline

Pre-increment (returns position after decrement)

Definition at line 132 of file SVIterator.h.

References stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator--().

Here is the call graph for this function:

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator== ( const self_type other) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator!= ( const self_type other) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
R stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator[] ( std::size_t  n) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
self_type& stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator+= ( std::ptrdiff_t  n)
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
self_type& stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator-= ( std::ptrdiff_t  n)
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
self_type stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator+ ( std::ptrdiff_t  n)
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
self_type stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator- ( std::ptrdiff_t  n)
inline

Return iterator pointing to n-th previous element.

Definition at line 184 of file SVIterator.h.

References stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_c, and stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_p.

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
long int stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator- ( const self_type other) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator< ( const self_type other) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator<= ( const self_type other) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator> ( const self_type other) const
inline
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::operator>= ( const self_type other) const
inline

Friends And Related Function Documentation

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
friend class SegmentedVector< T, N, Safe >
friend

Definition at line 232 of file SVIterator.h.

Member Data Documentation

template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
std::size_t stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_p
private
template<typename T, std::size_t N, bool Safe, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
container_pointer_type stride::util::SVIterator< T, N, Safe, P, R, is_const_iterator >::m_c
private

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