![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Safe iterators for Sequence. More...
#include <agrum/tools/core/sequence.h>
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... | |
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.
Key | The type of elements stored in the gum::Sequence. |
Definition at line 1199 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::const_pointer = const Key* |
types for STL compliance
Definition at line 1212 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::const_reference = const Key& |
types for STL compliance
Definition at line 1210 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::difference_type = std::ptrdiff_t |
types for STL compliance
Definition at line 1213 of file sequence.h.
|
private |
The Getter used by this iterator.
Definition at line 1218 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::iterator_category = std::bidirectional_iterator_tag |
types for STL compliance
Definition at line 1207 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::pointer = Key* |
types for STL compliance
Definition at line 1211 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::reference = Key& |
types for STL compliance
Definition at line 1209 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::value_type = Key |
types for STL compliance
Definition at line 1208 of file sequence.h.
|
privatenoexcept |
Constructor, always give a valid iterator (even if pos too large).
Alloc | The sequence allocator. |
Gen | Used for meta-programation. |
seq | The sequence. |
pos | Indicates to which position of the sequence the iterator should be pointing. By default, the iterator points to begin(). |
|
noexcept |
Constructor, always give a valid iterator (even if pos too large).
seq | the sequence |
pos | indicates to which position of the sequence the iterator should be pointing. By default, the iterator points to begin() |
Alloc | The sequence allocator. |
|
noexcept |
Copy constructor.
source | The iterator to copy. |
Definition at line 100 of file sequence_tpl.h.
|
noexcept |
Move constructor.
source | The iterator to move. |
Definition at line 109 of file sequence_tpl.h.
|
noexcept |
Class destructor.
Definition at line 118 of file sequence_tpl.h.
|
noexcept |
Definition at line 66 of file sequence_tpl.h.
|
noexcept |
Definition at line 84 of file sequence_tpl.h.
|
privatenoexcept |
The iterator points to the end (which is pos size()-1).
Definition at line 236 of file sequence_tpl.h.
|
privatenoexcept |
The iterator points to rend.
Definition at line 230 of file sequence_tpl.h.
|
privatenoexcept |
The iterator points to the posth element (0 = beginning of the sequence).
Definition at line 221 of file sequence_tpl.h.
|
noexcept |
Checks whether two iterators are pointing to different elements.
source | The iterator to test for inequality. |
Definition at line 204 of file sequence_tpl.h.
INLINE const Key & gum::SequenceIteratorSafe< Key >::operator* | ( | ) | const |
Returns the value pointed to by the iterator.
UndefinedIteratorValue | Raised on end() or rend(). |
Definition at line 242 of file sequence_tpl.h.
|
noexcept |
Returns a new iterator.
nb | The number of steps the created iterator is ahead of this. |
Definition at line 181 of file sequence_tpl.h.
|
noexcept |
Point the iterator to the next value in the sequence.
Definition at line 142 of file sequence_tpl.h.
|
noexcept |
Makes the iterator point to i elements further in the sequence.
nb | The number of steps to move the iterator. |
Definition at line 161 of file sequence_tpl.h.
|
noexcept |
Returns a new iterator.
nb | The number of steps the created iterator is behind of this. Returns a new iterator. |
Definition at line 187 of file sequence_tpl.h.
|
noexcept |
Point the iterator to the preceding value in the sequence.
Definition at line 153 of file sequence_tpl.h.
|
noexcept |
Makes the iterator point to i elements further in the sequence.
nb | The number of steps to move the iterator. |
Definition at line 171 of file sequence_tpl.h.
INLINE const Key * gum::SequenceIteratorSafe< Key >::operator-> | ( | ) | const |
Returns the value pointed to by the iterator (works only for non-scalars).
Definition at line 248 of file sequence_tpl.h.
|
noexcept |
Copy operator.
source | The iterator to copy. |
Definition at line 125 of file sequence_tpl.h.
|
noexcept |
Move operator.
source | The iterator to move. |
Definition at line 134 of file sequence_tpl.h.
|
noexcept |
Checks whether two iterators are pointing to the same elements.
source | The iterator to test for equality. |
Definition at line 193 of file sequence_tpl.h.
INLINE Idx gum::SequenceIteratorSafe< Key >::pos | ( | ) | const |
Returns the position of the iterator in the sequence.
UndefinedIteratorValue | Raised on end() or rend(). |
Definition at line 211 of file sequence_tpl.h.
|
friend |
Friend to speed up access.
Definition at line 1202 of file sequence.h.
|
private |
The index in the sequence's vector where the iterator is pointing.
Definition at line 1408 of file sequence.h.
|
private |
The sequence pointed to by the iterator (by default, key is a scalar).
Definition at line 1411 of file sequence.h.