![]() |
aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
|
Unsafe iterators for the Set class. More...
#include <agrum/base/core/set.h>
Public Types | |
| enum class | Position : unsigned char { BEGIN , END } |
| An enumeration to position the iterator at the beginning or the end of the set. More... | |
| using | iterator_category = std::forward_iterator_tag |
| Types for STL compliance. | |
| using | value_type = Key |
| Types for STL compliance. | |
| using | reference = value_type& |
| Types for STL compliance. | |
| using | const_reference = const value_type& |
| Types for STL compliance. | |
| using | pointer = value_type* |
| Types for STL compliance. | |
| using | const_pointer = const value_type* |
| Types for STL compliance. | |
| using | difference_type = std::ptrdiff_t |
| Types for STL compliance. | |
Public Member Functions | |
Constructors / Destructors | |
| SetIterator () noexcept | |
| Default constructor: the iterator points toward nothing. | |
| SetIterator (const Set< Key > &from, Position pos=Position::BEGIN) | |
| Creates an iterator for a given set. | |
| SetIterator (const SetIterator< Key > &iter) noexcept | |
| Copy constructor. | |
| SetIterator (SetIterator< Key > &&from) noexcept | |
| Move constructor. | |
| ~SetIterator () noexcept | |
| Class destructor. | |
Operators | |
| SetIterator< Key > & | operator= (const SetIterator< Key > &iter) noexcept |
| Assignment operator. | |
| SetIterator< Key > & | operator= (SetIterator< Key > &&from) noexcept |
| Assignment operator. | |
| SetIterator< Key > & | operator++ () noexcept |
| Increments the iterator. | |
| SetIterator< Key > & | operator+= (Size nb) noexcept |
| Makes the iterator point to i elements further in the set. | |
| SetIterator< Key > | operator+ (Size nb) const noexcept |
| Returns a new iterator. | |
| bool | operator== (const SetIterator< Key > &iter) const noexcept |
| Indicates whether two iterators point toward the same element of a same set. | |
| const Key & | operator* () const |
| Returns the element pointed to by the iterator. | |
| const Key * | operator-> () const |
| Returns a pointer to the element pointed to by the iterator. | |
Accessors / Modifiers | |
| void | clear () noexcept |
| makes the iterator point toward nothing (in particular, it is not related anymore to its current set). | |
Private Attributes | |
| HashTableConstIterator< Key, bool > | _ht_iter_ |
| The underlying iterator for the set's hash table containing the data. | |
Friends | |
| class | Set< Key > |
| For efficiency, Set should be able to modify the hash table iterator. | |
| class | SetIteratorSafe< Key > |
Unsafe iterators for the Set class.
Developers may consider using Set<x>::iterator instead of SetIterator<x>.
| Key | The elements type. |
| using gum::SetIterator< Key >::const_pointer = const value_type* |
| using gum::SetIterator< Key >::const_reference = const value_type& |
| using gum::SetIterator< Key >::difference_type = std::ptrdiff_t |
| using gum::SetIterator< Key >::iterator_category = std::forward_iterator_tag |
| using gum::SetIterator< Key >::pointer = value_type* |
| using gum::SetIterator< Key >::reference = value_type& |
| using gum::SetIterator< Key >::value_type = Key |
|
strong |
|
explicitnoexcept |
Default constructor: the iterator points toward nothing.
Definition at line 177 of file set_tpl.h.
References SetIterator().
Referenced by SetIterator(), SetIterator(), SetIterator(), SetIterator(), ~SetIterator(), operator+(), operator++(), operator+=(), operator=(), operator=(), and operator==().
|
explicit |
Creates an iterator for a given set.
By default, the iterator points to the beginning of the set, but, using optional argument pos, you can make it point to end().
| from | The gum::Set to iterator over. |
| pos | Where to start iterating. |
Definition at line 183 of file set_tpl.h.
References SetIterator(), _ht_iter_, and Set< Key >.
|
noexcept |
Copy constructor.
| iter | The iterator to copy. |
Definition at line 190 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
|
noexcept |
Move constructor.
| from | The iterator to move. |
Definition at line 197 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
|
noexcept |
Class destructor.
Definition at line 204 of file set_tpl.h.
References SetIterator().
|
noexcept |
makes the iterator point toward nothing (in particular, it is not related anymore to its current set).
Definition at line 267 of file set_tpl.h.
References _ht_iter_.
Referenced by Set< Key >.
| const Key & gum::SetIterator< Key >::operator* | ( | ) | const |
Returns the element pointed to by the iterator.
| UndefinedIteratorValue | Raised if the iterator does not point to an element of the set (for instance if the set or the element previously pointed to by the iterator have been deleted). |
Definition at line 250 of file set_tpl.h.
References _ht_iter_.
|
noexcept |
Returns a new iterator.
| nb | The number of increments. |
Definition at line 239 of file set_tpl.h.
References SetIterator().
|
noexcept |
Increments the iterator.
Definition at line 222 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
|
noexcept |
Makes the iterator point to i elements further in the set.
| nb | The number of increments. |
Definition at line 232 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
| const Key * gum::SetIterator< Key >::operator-> | ( | ) | const |
Returns a pointer to the element pointed to by the iterator.
| UndefinedIteratorValue | Raised if the iterator does not point to an element of the set (for instance if the set or the element previously pointed to by the iterator have been deleted). |
Definition at line 258 of file set_tpl.h.
References _ht_iter_.
|
defaultnoexcept |
Assignment operator.
| iter | The iterator to copy. |
References SetIterator().
|
noexcept |
|
defaultnoexcept |
Indicates whether two iterators point toward the same element of a same set.
| iter | The iterator to test for equality. |
References SetIterator().
For efficiency, Set should be able to modify the hash table iterator.
Definition at line 954 of file set.h.
References clear().
Referenced by SetIterator().
|
friend |
|
private |
The underlying iterator for the set's hash table containing the data.
Definition at line 964 of file set.h.
Referenced by SetIterator(), SetIterator(), SetIterator(), clear(), operator*(), operator++(), operator+=(), operator->(), operator=(), and gum::SetIteratorSafe< Key >::operator=().