![]() |
aGrUM
0.16.0
|
Safe iterators for Sequence. More...
#include <agrum/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 1206 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::const_pointer = const Key* |
types for STL compliance
Definition at line 1219 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::const_reference = const Key& |
types for STL compliance
Definition at line 1217 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::difference_type = std::ptrdiff_t |
types for STL compliance
Definition at line 1220 of file sequence.h.
|
private |
The Getter used by this iterator.
Definition at line 1225 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::iterator_category = std::bidirectional_iterator_tag |
types for STL compliance
Definition at line 1214 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::pointer = Key* |
types for STL compliance
Definition at line 1218 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::reference = Key& |
types for STL compliance
Definition at line 1216 of file sequence.h.
using gum::SequenceIteratorSafe< Key >::value_type = Key |
types for STL compliance
Definition at line 1215 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 67 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 243 of file sequence_tpl.h.
|
privatenoexcept |
The iterator points to rend.
Definition at line 237 of file sequence_tpl.h.
|
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().
|
noexcept |
Checks whether two iterators are pointing to different elements.
source | The iterator to test for inequality. |
Definition at line 212 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator==().
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 249 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 186 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator-=().
|
noexcept |
Point the iterator to the next value in the sequence.
Definition at line 143 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator=().
|
noexcept |
Makes the iterator point to i elements further in the sequence.
nb | The number of steps to move the iterator. |
Definition at line 164 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator--().
|
noexcept |
Returns a new iterator.
nb | The 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+().
|
noexcept |
Point the iterator to the preceding value in the sequence.
Definition at line 155 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator++().
|
noexcept |
Makes the iterator point to i elements further in the sequence.
nb | The number of steps to move the iterator. |
Definition at line 175 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator+=().
INLINE const Key * gum::SequenceIteratorSafe< Key >::operator-> | ( | ) | const |
Returns the value pointed to by the iterator (works only for non-scalars).
Definition at line 255 of file sequence_tpl.h.
|
noexcept |
Copy operator.
source | The iterator to copy. |
Definition at line 125 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator=(), and gum::SequenceIteratorSafe< NodeId >::~SequenceIteratorSafe().
|
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 200 of file sequence_tpl.h.
Referenced by gum::SequenceIteratorSafe< NodeId >::operator-().
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 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=().
|
friend |
Friend to speed up access.
Definition at line 1209 of file sequence.h.
|
private |
The index in the sequence's vector where the iterator is pointing.
Definition at line 1417 of file sequence.h.
|
private |
The sequence pointed to by the iterator (by default, key is a scalar).
Definition at line 1422 of file sequence.h.