aGrUM  0.14.2
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 1203 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 1216 of file sequence.h.

◆ const_reference

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

types for STL compliance

Definition at line 1214 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 1217 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 1222 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 1211 of file sequence.h.

◆ pointer

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

types for STL compliance

Definition at line 1215 of file sequence.h.

◆ reference

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

types for STL compliance

Definition at line 1213 of file sequence.h.

◆ value_type

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

types for STL compliance

Definition at line 1212 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 97 of file sequence_tpl.h.

98  :
99  __iterator{source.__iterator},
100  __seq{source.__seq} {
101  GUM_CONS_CPY(SequenceIteratorSafe);
102  }
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:1419
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
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 106 of file sequence_tpl.h.

107  :
108  __iterator{source.__iterator},
109  __seq{source.__seq} {
110  GUM_CONS_MOV(SequenceIteratorSafe);
111  }
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:1419
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
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 115 of file sequence_tpl.h.

115  {
116  GUM_DESTRUCTOR(SequenceIteratorSafe);
117  }
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 64 of file sequence_tpl.h.

65  :
66  __seq{reinterpret_cast<
67  const SequenceImplementation< Key,
68  std::allocator< Key >,
69  std::is_scalar< Key >::value >* >(&seq)} {
70  GUM_CONSTRUCTOR(SequenceIteratorSafe);
71 
72  if (pos > __seq->size())
73  __iterator = __seq->size(); // make the iterator point to end
74  else
75  __iterator = pos;
76  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:215
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
friend class SequenceImplementation
Friend to speed up access.
Definition: sequence.h:1206
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 81 of file sequence_tpl.h.

82  :
83  __seq{reinterpret_cast<
84  const SequenceImplementation< Key,
85  std::allocator< Key >,
86  std::is_scalar< Key >::value >* >(&seq)} {
87  GUM_CONSTRUCTOR(SequenceIteratorSafe);
88 
89  if (pos > __seq->size())
90  __iterator = __seq->size(); // make the iterator point to end
91  else
92  __iterator = pos;
93  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:215
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
friend class SequenceImplementation
Friend to speed up access.
Definition: sequence.h:1206
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 240 of file sequence_tpl.h.

240  {
241  __iterator = __seq->size();
242  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414

◆ __setAtRend()

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

The iterator points to rend.

Definition at line 234 of file sequence_tpl.h.

234  {
235  __iterator = std::numeric_limits< Idx >::max();
236  }
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414

◆ __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 225 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().

225  {
226  if (pos > __seq->size())
227  __iterator = __seq->size();
228  else
229  __iterator = pos;
230  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:215
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
+ 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 209 of file sequence_tpl.h.

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

209  {
210  return !operator==(source);
211  }
bool operator==(const SequenceIteratorSafe< Key > &source) const noexcept
Checks whether two iterators are pointing to the same elements.
Definition: sequence_tpl.h:197
+ 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 246 of file sequence_tpl.h.

246  {
247  return Getter::op_star(__seq->__v[pos()]);
248  }
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:1419
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:215
std::vector< Key *, typename Alloc::template rebind< Key *>::other > __v
The set of the elements stored into the sequence.
Definition: sequence.h:500

◆ 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 183 of file sequence_tpl.h.

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

183  {
184  return SequenceIteratorSafe< Key >{*this} += nb;
185  }
+ 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 140 of file sequence_tpl.h.

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

140  {
141  if (__iterator < __seq->size())
142  ++__iterator;
143  else
144  __iterator = __seq->size();
145 
146  return *this;
147  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
+ 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 161 of file sequence_tpl.h.

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

161  {
162  if (__iterator == std::numeric_limits< Idx >::max()) return *this;
163  __iterator += nb;
164  if (__iterator > __seq->size()) __iterator = __seq->size();
165 
166  return *this;
167  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
+ 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 190 of file sequence_tpl.h.

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

190  {
191  return SequenceIteratorSafe< Key >{*this} -= nb;
192  }
+ 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 152 of file sequence_tpl.h.

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

152  {
153  if (__iterator != std::numeric_limits< Idx >::max()) --__iterator;
154 
155  return *this;
156  }
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
+ 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 172 of file sequence_tpl.h.

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

172  {
173  if (__iterator == std::numeric_limits< Idx >::max()) return *this;
174  __iterator -= nb;
175  if (__iterator > __seq->size()) __iterator = std::numeric_limits< Idx >::max();
176 
177  return *this;
178  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
+ 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 252 of file sequence_tpl.h.

252  {
253  return Getter::op_arrow(__seq->__v[pos()]);
254  }
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:1419
Idx pos() const
Returns the position of the iterator in the sequence.
Definition: sequence_tpl.h:215
std::vector< Key *, typename Alloc::template rebind< Key *>::other > __v
The set of the elements stored into the sequence.
Definition: sequence.h:500

◆ 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 122 of file sequence_tpl.h.

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

122  {
123  __iterator = source.__iterator;
124  __seq = source.__seq;
125  return *this;
126  }
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:1419
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
+ 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 131 of file sequence_tpl.h.

131  {
132  __iterator = source.__iterator;
133  __seq = source.__seq;
134  return *this;
135  }
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:1419
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414

◆ 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 197 of file sequence_tpl.h.

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

197  {
198  if (__seq->empty())
199  return true; // all iterators are the same if seq is empty
200 
201  if ((__iterator != source.__iterator) || (__seq != source.__seq)) return false;
202 
203  return true;
204  }
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:1419
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
bool empty() const noexcept
Return true if empty.
Definition: sequence_tpl.h:41
+ 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 215 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=().

215  {
216  if (__iterator >= __seq->size()) {
217  GUM_ERROR(UndefinedIteratorValue, "iterator is end() or rend()");
218  }
219 
220  return __iterator;
221  }
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:1419
Size size() const noexcept
Returns the size of the sequence.
Definition: sequence_tpl.h:35
Idx __iterator
The index in the sequence&#39;s vector where the iterator is pointing.
Definition: sequence.h:1414
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ 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 1206 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 1414 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 1419 of file sequence.h.


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