![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Unsafe iterators for the Set class. More...
#include <agrum/base/core/set.h>
Public Types | |
| enum | Position { 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=BEGIN) | |
| Creates an iterator for a given set. | |
| SetIterator (const SetIterator< Key > &from) noexcept | |
| Copy constructor. | |
| SetIterator (SetIterator< Key > &&from) noexcept | |
| Move constructor. | |
| ~SetIterator () noexcept | |
| Class destructor. | |
Operators | |
| SetIterator< Key > & | operator= (const SetIterator< Key > &from) noexcept |
| Assignment operator. | |
| SetIterator< Key > & | operator= (SetIterator< Key > &&from) noexcept |
| Assignment operator. | |
| SetIterator< Key > & | operator++ () noexcept |
| Increments the iterator. | |
| SetIterator< Key > & | operator+= (Size i) noexcept |
| Makes the iterator point to i elements further in the set. | |
| SetIterator< Key > | operator+ (Size i) const noexcept |
| Returns a new iterator. | |
| bool | operator!= (const SetIterator< Key > &from) const noexcept |
| Indicates whether two iterators point to different elements or sets. | |
| bool | operator== (const SetIterator< Key > &from) 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 |
| enum gum::SetIterator::Position |
|
explicitnoexcept |
Default constructor: the iterator points toward nothing.
Definition at line 189 of file set_tpl.h.
References SetIterator().
Referenced by SetIterator(), SetIterator(), SetIterator(), SetIterator(), ~SetIterator(), operator!=(), operator+(), operator++(), operator+=(), operator=(), and operator==().
| INLINE gum::SetIterator< Key >::SetIterator | ( | const Set< Key > & | from, |
| Position | pos = BEGIN ) |
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 195 of file set_tpl.h.
References SetIterator(), _ht_iter_, END, and Set< Key >.
|
noexcept |
Copy constructor.
| from | The iterator to copy. |
Definition at line 202 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
|
noexcept |
Move constructor.
| from | The iterator to move. |
Definition at line 209 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
|
noexcept |
Class destructor.
Definition at line 216 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 290 of file set_tpl.h.
References _ht_iter_.
Referenced by Set< Key >.
|
noexcept |
Indicates whether two iterators point to different elements or sets.
| from | The iterator to test for inequality. |
Definition at line 260 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
| INLINE 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 273 of file set_tpl.h.
References _ht_iter_.
|
noexcept |
Returns a new iterator.
| i | The number of increments. |
Definition at line 254 of file set_tpl.h.
References SetIterator().
|
noexcept |
Increments the iterator.
Definition at line 237 of file set_tpl.h.
References SetIterator().
|
noexcept |
Makes the iterator point to i elements further in the set.
| i | The number of increments. |
Definition at line 247 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
| INLINE 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 281 of file set_tpl.h.
|
noexcept |
|
noexcept |
|
noexcept |
Indicates whether two iterators point toward the same element of a same set.
| from | The iterator to test for equality. |
Definition at line 267 of file set_tpl.h.
References SetIterator(), and _ht_iter_.
For efficiency, Set should be able to modify the hash table iterator.
Definition at line 971 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 981 of file set.h.
Referenced by SetIterator(), SetIterator(), SetIterator(), clear(), operator!=(), operator*(), operator+=(), operator=(), gum::SetIteratorSafe< Key >::operator=(), and operator==().