Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator > Class Template Reference

Implementation of iterator for SegmentedVector. More...

#include <SVIterator.h>

Inheritance diagram for UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >:
Inheritance graph
Collaboration diagram for UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >:
Collaboration graph

Public Types

using self_type = SVIterator< T, N, 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...
 
self_type operator++ (int)
 Post-increment (returns position prior to increment) More...
 
self_typeoperator-- ()
 Pre-decrement (returns position after decrement) More...
 
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)
 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 > *, SegmentedVector< T, N > * >::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...
 
bool IsDefaultContructed ()
 See class description. More...
 
bool IsPastTheEnd ()
 See class description. More...
 
bool IsDereferencable ()
 See class description. More...
 

Private Attributes

std::size_t m_p
 Current iterator position in the container. More...
 
container_pointer_type m_c
 

Static Private Attributes

static constexpr std::size_t m_end = std::numeric_limits<size_t>::max()
 One past the last element iterator position. More...
 

Friends

class SegmentedVector< T, N >
 

Detailed Description

template<typename T, std::size_t N, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
class UA_CoMP::Container::SVIterator< T, N, 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 == m_end. 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_end. 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 55 of file SVIterator.h.

Member Typedef Documentation

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

Definition at line 63 of file SVIterator.h.

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

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

Definition at line 207 of file SVIterator.h.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 69 of file SVIterator.h.

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

Copy constructor.

Definition at line 72 of file SVIterator.h.

template<typename T , std::size_t N, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
UA_CoMP::Container::SVIterator< T, N, 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 214 of file SVIterator.h.

Member Function Documentation

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

Post-increment (returns position prior to increment)

Definition at line 109 of file SVIterator.h.

References UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator++().

Here is the call graph for this function:

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

Pre-increment (returns position after decrement)

Definition at line 129 of file SVIterator.h.

References UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator--().

Here is the call graph for this function:

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

Return iterator pointing to n-th previous element.

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

Return distance between iterators.

Definition at line 180 of file SVIterator.h.

References UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::m_p.

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

Returns whether iterator is before other.

Definition at line 183 of file SVIterator.h.

References UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::m_p.

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

Returns whether iterator is not after other.

Definition at line 186 of file SVIterator.h.

References UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::m_p.

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

Returns whether iterator is after other.

Definition at line 189 of file SVIterator.h.

References UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::m_p.

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

Returns whether iterator is not after other.

Definition at line 192 of file SVIterator.h.

References UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::m_p.

template<typename T , std::size_t N, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::IsDefaultContructed ( )
inlineprivate
template<typename T , std::size_t N, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::IsPastTheEnd ( )
inlineprivate
template<typename T , std::size_t N, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
bool UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::IsDereferencable ( )
inlineprivate

Friends And Related Function Documentation

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

Definition at line 195 of file SVIterator.h.

Member Data Documentation

template<typename T , std::size_t N, typename P = const T*, typename R = const T&, bool is_const_iterator = true>
std::size_t UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::m_p
private

Current iterator position in the container.

Definition at line 199 of file SVIterator.h.

Referenced by UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::IsDefaultContructed(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::IsDereferencable(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::IsPastTheEnd(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator!=(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator*(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator+(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator++(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator+=(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator-(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator--(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator-=(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator->(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator<(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator<=(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator==(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator>(), UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator>=(), and UA_CoMP::Container::SVIterator< T, N, P, R, is_const_iterator >::operator[]().


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