Doxygen
Loading...
Searching...
No Matches
GrowVector< T >::Iterator< C, I > Class Template Reference

bidirectional iterator More...

#include <src/growvector.h>

+ Inheritance diagram for GrowVector< T >::Iterator< C, I >:

Public Types

using iterator_category = std::bidirectional_iterator_tag
 
using difference_type = std::ptrdiff_t
 
using value_type = I
 
using pointer = I*
 
using reference = I&
 

Public Member Functions

 Iterator (C &vec, size_t pos)
 
reference operator* () const
 
pointer operator-> ()
 
Iteratoroperator++ ()
 
Iterator operator++ (int)
 
Iteratoroperator-- ()
 
Iterator operator-- (int)
 

Private Attributes

C * m_vec
 
size_t m_pos
 

Friends

bool operator== (const Iterator &a, const Iterator &b)
 
bool operator!= (const Iterator &a, const Iterator &b)
 

Detailed Description

template<class T>
template<class C, class I>
class GrowVector< T >::Iterator< C, I >

bidirectional iterator

Definition at line 55 of file growvector.h.

Member Typedef Documentation

◆ difference_type

template<class T>
template<class C, class I>
using GrowVector< T >::Iterator< C, I >::difference_type = std::ptrdiff_t

Definition at line 59 of file growvector.h.

◆ iterator_category

template<class T>
template<class C, class I>
using GrowVector< T >::Iterator< C, I >::iterator_category = std::bidirectional_iterator_tag

Definition at line 58 of file growvector.h.

◆ pointer

template<class T>
template<class C, class I>
using GrowVector< T >::Iterator< C, I >::pointer = I*

Definition at line 61 of file growvector.h.

◆ reference

template<class T>
template<class C, class I>
using GrowVector< T >::Iterator< C, I >::reference = I&

Definition at line 62 of file growvector.h.

◆ value_type

template<class T>
template<class C, class I>
using GrowVector< T >::Iterator< C, I >::value_type = I

Definition at line 60 of file growvector.h.

Constructor & Destructor Documentation

◆ Iterator()

template<class T>
template<class C, class I>
GrowVector< T >::Iterator< C, I >::Iterator ( C & vec,
size_t pos )
inline

Definition at line 64 of file growvector.h.

64: m_vec(&vec), m_pos(pos) {}
std::vector like container optimized for pushing elements to the back.
Definition growvector.h:40

References m_pos, and m_vec.

Referenced by operator!=, operator++(), operator++(), operator--(), operator--(), and operator==.

Member Function Documentation

◆ operator*()

template<class T>
template<class C, class I>
reference GrowVector< T >::Iterator< C, I >::operator* ( ) const
inline

Definition at line 66 of file growvector.h.

66{ return m_vec->at(m_pos); }

References m_pos, and m_vec.

◆ operator++() [1/2]

template<class T>
template<class C, class I>
Iterator & GrowVector< T >::Iterator< C, I >::operator++ ( )
inline

Definition at line 68 of file growvector.h.

68{ m_pos++; return *this; }

References Iterator(), and m_pos.

◆ operator++() [2/2]

template<class T>
template<class C, class I>
Iterator GrowVector< T >::Iterator< C, I >::operator++ ( int )
inline

Definition at line 69 of file growvector.h.

69{ Iterator tmp = *this; ++(*this); return tmp; }
Iterator(C &vec, size_t pos)
Definition growvector.h:64

References Iterator().

◆ operator--() [1/2]

template<class T>
template<class C, class I>
Iterator & GrowVector< T >::Iterator< C, I >::operator-- ( )
inline

Definition at line 70 of file growvector.h.

70{ m_pos--; return *this; }

References Iterator(), and m_pos.

◆ operator--() [2/2]

template<class T>
template<class C, class I>
Iterator GrowVector< T >::Iterator< C, I >::operator-- ( int )
inline

Definition at line 71 of file growvector.h.

71{ Iterator tmp = *this; --(*this); return tmp; }

References Iterator().

◆ operator->()

template<class T>
template<class C, class I>
pointer GrowVector< T >::Iterator< C, I >::operator-> ( )
inline

Definition at line 67 of file growvector.h.

67{ return &m_vec->at(m_pos); }

References m_pos, and m_vec.

Friends And Related Symbol Documentation

◆ operator!=

template<class T>
template<class C, class I>
bool operator!= ( const Iterator< C, I > & a,
const Iterator< C, I > & b )
friend

Definition at line 73 of file growvector.h.

73{ return a.m_pos != b.m_pos; };

References Iterator(), and m_pos.

◆ operator==

template<class T>
template<class C, class I>
bool operator== ( const Iterator< C, I > & a,
const Iterator< C, I > & b )
friend

Definition at line 72 of file growvector.h.

72{ return a.m_pos == b.m_pos; };

References Iterator(), and m_pos.

Member Data Documentation

◆ m_pos

template<class T>
template<class C, class I>
size_t GrowVector< T >::Iterator< C, I >::m_pos
private

Definition at line 77 of file growvector.h.

Referenced by Iterator(), operator!=, operator*(), operator++(), operator--(), operator->(), and operator==.

◆ m_vec

template<class T>
template<class C, class I>
C* GrowVector< T >::Iterator< C, I >::m_vec
private

Definition at line 76 of file growvector.h.

Referenced by Iterator(), operator*(), and operator->().


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