aGrUM  0.16.0
gum::SequenceIteratorSafe< Key > Class Template Reference

Safe iterators for Sequence. More...

#include <agrum/core/sequence.h>

+ Collaboration diagram for gum::SequenceIteratorSafe< Key >:

Public Member Functions

template<typename Alloc , bool Gen>
INLINE SequenceIteratorSafe (const SequenceImplementation< Key, Alloc, Gen > &seq, Idx pos) noexcept
 
template<typename Alloc >
INLINE SequenceIteratorSafe (const Sequence< Key, Alloc > &seq, Idx pos) noexcept
 
Constructors / Destructors
template<typename Alloc >
 SequenceIteratorSafe (const Sequence< Key, Alloc > &seq, Idx pos=0) noexcept
 Constructor, always give a valid iterator (even if pos too large). More...
 
 SequenceIteratorSafe (const SequenceIteratorSafe< Key > &source) noexcept
 Copy constructor. More...
 
 SequenceIteratorSafe (SequenceIteratorSafe< Key > &&source) noexcept
 Move constructor. More...
 
 ~SequenceIteratorSafe () noexcept
 Class destructor. More...
 
Operators
SequenceIteratorSafe< Key > & operator= (const SequenceIteratorSafe< Key > &source) noexcept
 Copy operator. More...
 
SequenceIteratorSafe< Key > & operator= (SequenceIteratorSafe< Key > &&source) noexcept
 Move operator. More...
 
SequenceIteratorSafe< Key > & operator++ () noexcept
 Point the iterator to the next value in the sequence. More...
 
SequenceIteratorSafe< Key > & operator-- () noexcept
 Point the iterator to the preceding value in the sequence. More...
 
SequenceIteratorSafe< Key > & operator+= (Size nb) noexcept
 Makes the iterator point to i elements further in the sequence. More...
 
SequenceIteratorSafe< Key > & operator-= (Size nb) noexcept
 Makes the iterator point to i elements further in the sequence. More...
 
SequenceIteratorSafe< Key > operator+ (Size nb) noexcept
 Returns a new iterator. More...
 
SequenceIteratorSafe< Key > operator- (Size nb) noexcept
 Returns a new iterator. More...
 
bool operator!= (const SequenceIteratorSafe< Key > &source) const noexcept
 Checks whether two iterators are pointing to different elements. More...
 
bool operator== (const SequenceIteratorSafe< Key > &source) const noexcept
 Checks whether two iterators are pointing to the same elements. More...
 
const Key & operator* () const
 Returns the value pointed to by the iterator. More...
 
const Key * operator-> () const
 Returns the value pointed to by the iterator (works only for non-scalars). More...
 
Accessors / Modifiers
Idx pos () const
 Returns the position of the iterator in the sequence. More...
 

Public Types

using iterator_category = std::bidirectional_iterator_tag
 types for STL compliance More...
 
using value_type = Key
 types for STL compliance More...
 
using reference = Key &
 types for STL compliance More...
 
using const_reference = const Key &
 types for STL compliance More...
 
using pointer = Key *
 types for STL compliance More...
 
using const_pointer = const Key *
 types for STL compliance More...
 
using difference_type = std::ptrdiff_t
 types for STL compliance More...
 

Friends

template<typename K , typename A , bool >
class SequenceImplementation
 Friend to speed up access. More...
 

Detailed Description

template<typename Key>
class gum::SequenceIteratorSafe< Key >

Safe iterators for Sequence.

This iterator enables to parse the elements in the sequence. Note that this is similar to a const safe iterator because the elements that can be accessed in the sequence are constant.

Usage example:
// creation of a sequence
Sequence<int> seq { 1, 2, 3, 4 };
Sequence<string> seq2;
// creation of iterators
auto iter1 = seq.beginSafe (); // points to 1
auto iiter2 = iter1;
auto iiter3 = std::move ( iter1 );
// parsing the sequence
for ( auto iter = seq.beginSafe (); iter != seq.endSafe (); ++iter )
std::cout << *iter << std::endl;
for ( auto iter = seq.rbeginSafe (); iter != seq.rend (); --iter )
std::cout << *iter << std::endl;
for ( auto iter = seq.beginSafe (); iter != seq.end (); ++iter )
std::cout << iter->size () << std::endl;
Template Parameters
KeyThe type of elements stored in the gum::Sequence.

Definition at line 1206 of file sequence.h.

Member Typedef Documentation

◆ const_pointer

template<typename Key>
using gum::SequenceIteratorSafe< Key >::const_pointer = const Key*

types for STL compliance

Definition at line 1219 of file sequence.h.

◆ const_reference

template<typename Key>
using gum::SequenceIteratorSafe< Key >::const_reference = const Key&

types for STL compliance

Definition at line 1217 of file sequence.h.

◆ difference_type

template<typename Key>
using gum::SequenceIteratorSafe< Key >::difference_type = std::ptrdiff_t

types for STL compliance

Definition at line 1220 of file sequence.h.

◆ Getter

template<typename Key>
using gum::SequenceIteratorSafe< Key >::Getter = SequenceIteratorGet< std::is_scalar< Key >::value >
private

The Getter used by this iterator.

Definition at line 1225 of file sequence.h.

◆ iterator_category

template<typename Key>
using gum::SequenceIteratorSafe< Key >::iterator_category = std::bidirectional_iterator_tag

types for STL compliance

Definition at line 1214 of file sequence.h.

◆ pointer

template<typename Key>
using gum::SequenceIteratorSafe< Key >::pointer = Key*

types for STL compliance

Definition at line 1218 of file sequence.h.

◆ reference

template<typename Key>
using gum::SequenceIteratorSafe< Key >::reference = Key&

types for STL compliance

Definition at line 1216 of file sequence.h.

◆ value_type

template<typename Key>
using gum::SequenceIteratorSafe< Key >::value_type = Key

types for STL compliance

Definition at line 1215 of file sequence.h.

Constructor & Destructor Documentation

◆ SequenceIteratorSafe() [1/6]

template<typename Key>
template<typename Alloc , bool Gen>
gum::SequenceIteratorSafe< Key >::SequenceIteratorSafe ( const SequenceImplementation< Key, Alloc, Gen > &  seq,
Idx  pos = 0 
)
privatenoexcept

Constructor, always give a valid iterator (even if pos too large).

Warning
if pos is greater than the size of the sequence, the iterator is made pointing to end().
Template Parameters
AllocThe sequence allocator.
GenUsed for meta-programation.
Parameters
seqThe sequence.
posIndicates to which position of the sequence the iterator should be pointing. By default, the iterator points to begin().

◆ SequenceIteratorSafe() [2/6]

template<typename Key>
template<typename Alloc >
gum::SequenceIteratorSafe< Key >::SequenceIteratorSafe ( const Sequence< Key, Alloc > &  seq,
Idx  pos = 0 
)
noexcept

Constructor, always give a valid iterator (even if pos too large).

Warning
if pos is greater than the size of the sequence, the iterator is made pointing to end().
Parameters
seqthe sequence
posindicates to which position of the sequence the iterator should be pointing. By default, the iterator points to begin()
Template Parameters
AllocThe sequence allocator.

◆ SequenceIteratorSafe() [3/6]

template<typename Key>
INLINE gum::SequenceIteratorSafe< Key >::SequenceIteratorSafe ( const SequenceIteratorSafe< Key > &  source)
noexcept

Copy constructor.

Parameters
sourceThe iterator to copy.

Definition at line 100 of file sequence_tpl.h.

101  :
102  __iterator{source.__iterator},
103  __seq{source.__seq} {
104  GUM_CONS_CPY(SequenceIteratorSafe);
105  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
SequenceIteratorSafe(const SequenceImplementation< Key, Alloc, Gen > &seq, Idx pos=0) noexcept
Constructor, always give a valid iterator (even if pos too large).

◆ SequenceIteratorSafe() [4/6]

template<typename Key>
INLINE gum::SequenceIteratorSafe< Key >::SequenceIteratorSafe ( SequenceIteratorSafe< Key > &&  source)
noexcept

Move constructor.

Parameters
sourceThe iterator to move.

Definition at line 109 of file sequence_tpl.h.

110  :
111  __iterator{source.__iterator},
112  __seq{source.__seq} {
113  GUM_CONS_MOV(SequenceIteratorSafe);
114  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
SequenceIteratorSafe(const SequenceImplementation< Key, Alloc, Gen > &seq, Idx pos=0) noexcept
Constructor, always give a valid iterator (even if pos too large).

◆ ~SequenceIteratorSafe()

template<typename Key >
INLINE gum::SequenceIteratorSafe< Key >::~SequenceIteratorSafe ( )
noexcept

Class destructor.

Definition at line 118 of file sequence_tpl.h.

118  {
119  GUM_DESTRUCTOR(SequenceIteratorSafe);
120  }
SequenceIteratorSafe(const SequenceImplementation< Key, Alloc, Gen > &seq, Idx pos=0) noexcept
Constructor, always give a valid iterator (even if pos too large).

◆ SequenceIteratorSafe() [5/6]

template<typename Key>
template<typename Alloc , bool Gen>
INLINE gum::SequenceIteratorSafe< Key >::SequenceIteratorSafe ( const SequenceImplementation< Key, Alloc, Gen > &  seq,
Idx  pos 
)
noexcept

Definition at line 67 of file sequence_tpl.h.

68  :
69  __seq{reinterpret_cast<
70  const SequenceImplementation< Key,
71  std::allocator< Key >,
72  std::is_scalar< Key >::value >* >(&seq)} {
73  GUM_CONSTRUCTOR(SequenceIteratorSafe);
74 
75  if (pos > __seq->size())
76  __iterator = __seq->size(); // make the iterator point to end
77  else
78  __iterator = pos;
79  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:218
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
friend class SequenceImplementation
Friend to speed up access.
Definition: sequence.h:1209
SequenceIteratorSafe(const SequenceImplementation< Key, Alloc, Gen > &seq, Idx pos=0) noexcept
Constructor, always give a valid iterator (even if pos too large).

◆ SequenceIteratorSafe() [6/6]

template<typename Key>
template<typename Alloc >
INLINE gum::SequenceIteratorSafe< Key >::SequenceIteratorSafe ( const Sequence< Key, Alloc > &  seq,
Idx  pos 
)
noexcept

Definition at line 84 of file sequence_tpl.h.

85  :
86  __seq{reinterpret_cast<
87  const SequenceImplementation< Key,
88  std::allocator< Key >,
89  std::is_scalar< Key >::value >* >(&seq)} {
90  GUM_CONSTRUCTOR(SequenceIteratorSafe);
91 
92  if (pos > __seq->size())
93  __iterator = __seq->size(); // make the iterator point to end
94  else
95  __iterator = pos;
96  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:218
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
friend class SequenceImplementation
Friend to speed up access.
Definition: sequence.h:1209
SequenceIteratorSafe(const SequenceImplementation< Key, Alloc, Gen > &seq, Idx pos=0) noexcept
Constructor, always give a valid iterator (even if pos too large).

Member Function Documentation

◆ __setAtEnd()

template<typename Key >
INLINE void gum::SequenceIteratorSafe< Key >::__setAtEnd ( )
privatenoexcept

The iterator points to the end (which is pos size()-1).

Definition at line 243 of file sequence_tpl.h.

243  {
244  __iterator = __seq->size();
245  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417

◆ __setAtRend()

template<typename Key >
INLINE void gum::SequenceIteratorSafe< Key >::__setAtRend ( )
privatenoexcept

The iterator points to rend.

Definition at line 237 of file sequence_tpl.h.

237  {
238  __iterator = std::numeric_limits< Idx >::max();
239  }
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417

◆ __setPos()

template<typename Key >
INLINE void gum::SequenceIteratorSafe< Key >::__setPos ( Idx  pos)
privatenoexcept

The iterator points to the posth element (0 = beginning of the sequence).

Definition at line 228 of file sequence_tpl.h.

Referenced by gum::operator<<(), and gum::SequenceImplementation< gum::prm::PRMClassElement< double > *, std::allocator< gum::prm::PRMClassElement< double > *>, std::is_scalar< gum::prm::PRMClassElement< double > *>::value >::rbeginSafe().

228  {
229  if (pos > __seq->size())
230  __iterator = __seq->size();
231  else
232  __iterator = pos;
233  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:218
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
+ Here is the caller graph for this function:

◆ operator!=()

template<typename Key>
INLINE bool gum::SequenceIteratorSafe< Key >::operator!= ( const SequenceIteratorSafe< Key > &  source) const
noexcept

Checks whether two iterators are pointing to different elements.

Parameters
sourceThe iterator to test for inequality.
Returns
Returns true if both iterators are not equal.

Definition at line 212 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator==().

212  {
213  return !operator==(source);
214  }
bool operator==(const SequenceIteratorSafe< Key > &source) const noexcept
Checks whether two iterators are pointing to the same elements.
Definition: sequence_tpl.h:200
+ Here is the caller graph for this function:

◆ operator*()

template<typename Key >
INLINE const Key & gum::SequenceIteratorSafe< Key >::operator* ( ) const

Returns the value pointed to by the iterator.

Returns
Returns the value pointed to by the iterator.
Exceptions
UndefinedIteratorValueRaised on end() or rend().

Definition at line 249 of file sequence_tpl.h.

249  {
250  return Getter::op_star(__seq->__v[pos()]);
251  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:218
std::vector< Key *, typename Alloc::template rebind< Key *>::other > __v
The set of the elements stored into the sequence.
Definition: sequence.h:503

◆ operator+()

template<typename Key >
INLINE SequenceIteratorSafe< Key > gum::SequenceIteratorSafe< Key >::operator+ ( Size  nb)
noexcept

Returns a new iterator.

Warning
The created iterator should point outside the Sequence, then it is set either to end or rend, depending on the sign of nb.
Parameters
nbThe number of steps the created iterator is ahead of this.
Returns
Returns a new iterator.

Definition at line 186 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator-=().

186  {
187  return SequenceIteratorSafe< Key >{*this} += nb;
188  }
+ Here is the caller graph for this function:

◆ operator++()

template<typename Key >
INLINE SequenceIteratorSafe< Key > & gum::SequenceIteratorSafe< Key >::operator++ ( )
noexcept

Point the iterator to the next value in the sequence.

Warning
if the iterator already points to end(), it is unaltered.
Returns
Returns this iterator.

Definition at line 143 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator=().

143  {
144  if (__iterator < __seq->size())
145  ++__iterator;
146  else
147  __iterator = __seq->size();
148 
149  return *this;
150  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
+ Here is the caller graph for this function:

◆ operator+=()

template<typename Key >
INLINE SequenceIteratorSafe< Key > & gum::SequenceIteratorSafe< Key >::operator+= ( Size  nb)
noexcept

Makes the iterator point to i elements further in the sequence.

Warning
If moving the iterator nb would make it point outside the Sequence, then iterator is moved to end or rend, depending on the sign of nb.
Parameters
nbThe number of steps to move the iterator.
Returns
Returns this iterator.

Definition at line 164 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator--().

164  {
165  if (__iterator == std::numeric_limits< Idx >::max()) return *this;
166  __iterator += nb;
167  if (__iterator > __seq->size()) __iterator = __seq->size();
168 
169  return *this;
170  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
+ Here is the caller graph for this function:

◆ operator-()

template<typename Key >
INLINE SequenceIteratorSafe< Key > gum::SequenceIteratorSafe< Key >::operator- ( Size  nb)
noexcept

Returns a new iterator.

Warning
The created iterator should point outside the Sequence, then it is set either to end or rend, depending on the sign of nb.
Parameters
nbThe number of steps the created iterator is behind of this. Returns a new iterator.

Definition at line 193 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator+().

193  {
194  return SequenceIteratorSafe< Key >{*this} -= nb;
195  }
+ Here is the caller graph for this function:

◆ operator--()

template<typename Key >
INLINE SequenceIteratorSafe< Key > & gum::SequenceIteratorSafe< Key >::operator-- ( )
noexcept

Point the iterator to the preceding value in the sequence.

Warning
If the iterator already points to rend(), it is unaltered.
Returns
Returns this iterator.

Definition at line 155 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator++().

155  {
156  if (__iterator != std::numeric_limits< Idx >::max()) --__iterator;
157 
158  return *this;
159  }
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
+ Here is the caller graph for this function:

◆ operator-=()

template<typename Key >
INLINE SequenceIteratorSafe< Key > & gum::SequenceIteratorSafe< Key >::operator-= ( Size  nb)
noexcept

Makes the iterator point to i elements further in the sequence.

Warning
If moving the iterator nb would make it point outside the Sequence, then iterator is moved to end or rend, depending on the sign of nb.
Parameters
nbThe number of steps to move the iterator.
Returns
Returns this iterator.

Definition at line 175 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator+=().

175  {
176  if (__iterator == std::numeric_limits< Idx >::max()) return *this;
177  __iterator -= nb;
178  if (__iterator > __seq->size()) __iterator = std::numeric_limits< Idx >::max();
179 
180  return *this;
181  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
+ Here is the caller graph for this function:

◆ operator->()

template<typename Key >
INLINE const Key * gum::SequenceIteratorSafe< Key >::operator-> ( ) const

Returns the value pointed to by the iterator (works only for non-scalars).

Returns
Returns the value pointed to by the iterator (works only for non-scalars).

Definition at line 255 of file sequence_tpl.h.

255  {
256  return Getter::op_arrow(__seq->__v[pos()]);
257  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:218
std::vector< Key *, typename Alloc::template rebind< Key *>::other > __v
The set of the elements stored into the sequence.
Definition: sequence.h:503

◆ operator=() [1/2]

template<typename Key>
INLINE SequenceIteratorSafe< Key > & gum::SequenceIteratorSafe< Key >::operator= ( const SequenceIteratorSafe< Key > &  source)
noexcept

Copy operator.

Parameters
sourceThe iterator to copy.
Returns
Returns this iterator.

Definition at line 125 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator=(), and gum::SequenceIteratorSafe< NodeId >::~SequenceIteratorSafe().

125  {
126  __iterator = source.__iterator;
127  __seq = source.__seq;
128  return *this;
129  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
+ Here is the caller graph for this function:

◆ operator=() [2/2]

template<typename Key>
INLINE SequenceIteratorSafe< Key > & gum::SequenceIteratorSafe< Key >::operator= ( SequenceIteratorSafe< Key > &&  source)
noexcept

Move operator.

Parameters
sourceThe iterator to move.
Returns
Returns this iterator.

Definition at line 134 of file sequence_tpl.h.

134  {
135  __iterator = source.__iterator;
136  __seq = source.__seq;
137  return *this;
138  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417

◆ operator==()

template<typename Key>
INLINE bool gum::SequenceIteratorSafe< Key >::operator== ( const SequenceIteratorSafe< Key > &  source) const
noexcept

Checks whether two iterators are pointing to the same elements.

Parameters
sourceThe iterator to test for equality.
Returns
Returns true if both iterators are equal.

Definition at line 200 of file sequence_tpl.h.

Referenced by gum::SequenceIteratorSafe< NodeId >::operator-().

200  {
201  if (__seq->empty())
202  return true; // all iterators are the same if seq is empty
203 
204  if ((__iterator != source.__iterator) || (__seq != source.__seq)) return false;
205 
206  return true;
207  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
bool empty() const noexcept
Return true if empty.
Definition: sequence_tpl.h:44
+ Here is the caller graph for this function:

◆ pos()

template<typename Key >
INLINE Idx gum::SequenceIteratorSafe< Key >::pos ( ) const

Returns the position of the iterator in the sequence.

Returns
Returns the position of the iterator in the sequence.
Exceptions
UndefinedIteratorValueRaised on end() or rend().

Definition at line 218 of file sequence_tpl.h.

Referenced by gum::SequenceImplementation< gum::prm::PRMClassElement< double > *, std::allocator< gum::prm::PRMClassElement< double > *>, std::is_scalar< gum::prm::PRMClassElement< double > *>::value >::erase(), and gum::SequenceImplementation< gum::prm::PRMClassElement< double > *, std::allocator< gum::prm::PRMClassElement< double > *>, std::is_scalar< gum::prm::PRMClassElement< double > *>::value >::operator=().

218  {
219  if (__iterator >= __seq->size()) {
220  GUM_ERROR(UndefinedIteratorValue, "iterator is end() or rend()");
221  }
222 
223  return __iterator;
224  }
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value > * __seq
The sequence pointed to by the iterator (by default, key is a scalar).
Definition: sequence.h:1422
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:38
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1417
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ SequenceImplementation

template<typename Key>
template<typename K , typename A , bool >
friend class SequenceImplementation
friend

Friend to speed up access.

Definition at line 1209 of file sequence.h.

Member Data Documentation

◆ __iterator

template<typename Key>
Idx gum::SequenceIteratorSafe< Key >::__iterator
private

The index in the sequence's vector where the iterator is pointing.

Definition at line 1417 of file sequence.h.

◆ __seq

template<typename Key>
const SequenceImplementation< Key, std::allocator< Key >, std::is_scalar< Key >::value >* gum::SequenceIteratorSafe< Key >::__seq
private

The sequence pointed to by the iterator (by default, key is a scalar).

Definition at line 1422 of file sequence.h.


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