![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Safe 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 | |
| SetIteratorSafe () | |
| Default constructor: the iterator points toward nothing. | |
| SetIteratorSafe (const Set< Key > &from, Position pos=BEGIN) | |
| Creates an iterator for a given set. | |
| SetIteratorSafe (const SetIteratorSafe< Key > &from) | |
| Copy constructor. | |
| SetIteratorSafe (const SetIterator< Key > &from) | |
| Copy constructor. | |
| SetIteratorSafe (SetIteratorSafe< Key > &&from) | |
| Move constructor. | |
| ~SetIteratorSafe () noexcept | |
| Class destructor. | |
Operators | |
| SetIteratorSafe< Key > & | operator= (const SetIteratorSafe< Key > &from) |
| Assignment operator. | |
| SetIteratorSafe< Key > & | operator= (const SetIterator< Key > &from) |
| Assignment operator. | |
| SetIteratorSafe< Key > & | operator= (SetIteratorSafe< Key > &&from) noexcept |
| Assignment operator. | |
| SetIteratorSafe< Key > & | operator++ () noexcept |
| Increments the iterator. | |
| SetIteratorSafe< Key > & | operator+= (Size i) noexcept |
| Makes the iterator point to i elements further in the set. | |
| SetIteratorSafe< Key > | operator+ (Size i) const |
| Returns a new iterator. | |
| bool | operator!= (const SetIteratorSafe< Key > &from) const noexcept |
| Indicates whether two iterators point to different elements or sets. | |
| bool | operator== (const SetIteratorSafe< 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 | |
| HashTableConstIteratorSafe< 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. | |
Safe iterators for the Set class.
Developers may consider using Set<x>::iterator_safe instead of SetIteratorSafe<x>.
| Key | The elements type. |
| using gum::SetIteratorSafe< Key >::const_pointer = const value_type* |
| using gum::SetIteratorSafe< Key >::const_reference = const value_type& |
| using gum::SetIteratorSafe< Key >::difference_type = std::ptrdiff_t |
| using gum::SetIteratorSafe< Key >::iterator_category = std::forward_iterator_tag |
| using gum::SetIteratorSafe< Key >::pointer = value_type* |
| using gum::SetIteratorSafe< Key >::reference = value_type& |
| using gum::SetIteratorSafe< Key >::value_type = Key |
| enum gum::SetIteratorSafe::Position |
|
explicit |
Default constructor: the iterator points toward nothing.
Definition at line 60 of file set_tpl.h.
References SetIteratorSafe().
Referenced by SetIteratorSafe(), SetIteratorSafe(), SetIteratorSafe(), SetIteratorSafe(), SetIteratorSafe(), ~SetIteratorSafe(), operator!=(), operator+(), operator++(), operator+=(), operator=(), operator=(), operator=(), and operator==().
| INLINE gum::SetIteratorSafe< Key >::SetIteratorSafe | ( | 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 iterate over. |
| pos | Where to start iterating. |
Definition at line 66 of file set_tpl.h.
References SetIteratorSafe(), _ht_iter_, END, and Set< Key >.
| INLINE gum::SetIteratorSafe< Key >::SetIteratorSafe | ( | const SetIteratorSafe< Key > & | from | ) |
Copy constructor.
| from | The iterator to copy. |
Definition at line 74 of file set_tpl.h.
References SetIteratorSafe(), and _ht_iter_.
|
explicit |
Copy constructor.
| from | The iterator to copy. |
Definition at line 81 of file set_tpl.h.
References SetIteratorSafe(), and _ht_iter_.
| INLINE gum::SetIteratorSafe< Key >::SetIteratorSafe | ( | SetIteratorSafe< Key > && | from | ) |
Move constructor.
| from | The iterator to move. |
Definition at line 88 of file set_tpl.h.
References SetIteratorSafe(), and _ht_iter_.
|
noexcept |
Class destructor.
Definition at line 95 of file set_tpl.h.
References SetIteratorSafe().
|
noexcept |
|
noexcept |
Indicates whether two iterators point to different elements or sets.
| from | The iterator to test for inequality. |
Definition at line 148 of file set_tpl.h.
References SetIteratorSafe(), and _ht_iter_.
| INLINE const Key & gum::SetIteratorSafe< 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 162 of file set_tpl.h.
| INLINE SetIteratorSafe< Key > gum::SetIteratorSafe< Key >::operator+ | ( | Size | i | ) | const |
Returns a new iterator.
| i | The number of increments. |
Definition at line 141 of file set_tpl.h.
References SetIteratorSafe().
|
noexcept |
Increments the iterator.
Definition at line 124 of file set_tpl.h.
References SetIteratorSafe(), and _ht_iter_.
|
noexcept |
Makes the iterator point to i elements further in the set.
| i | The number of increments. |
Definition at line 134 of file set_tpl.h.
References SetIteratorSafe(), and _ht_iter_.
| INLINE const Key * gum::SetIteratorSafe< 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 170 of file set_tpl.h.
References _ht_iter_.
| INLINE SetIteratorSafe< Key > & gum::SetIteratorSafe< Key >::operator= | ( | const SetIterator< Key > & | from | ) |
Assignment operator.
| from | The iterator to copy. |
Definition at line 109 of file set_tpl.h.
References SetIteratorSafe(), gum::SetIterator< Key >::_ht_iter_, and _ht_iter_.
| INLINE SetIteratorSafe< Key > & gum::SetIteratorSafe< Key >::operator= | ( | const SetIteratorSafe< Key > & | from | ) |
|
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 156 of file set_tpl.h.
References SetIteratorSafe(), and _ht_iter_.
For efficiency, Set should be able to modify the hash table iterator.
Definition at line 766 of file set.h.
Referenced by SetIteratorSafe().
|
private |
The underlying iterator for the set's hash table containing the data.
Definition at line 775 of file set.h.
Referenced by SetIteratorSafe(), SetIteratorSafe(), SetIteratorSafe(), SetIteratorSafe(), clear(), gum::Set< Key >::erase(), operator!=(), operator++(), operator+=(), operator->(), operator=(), operator=(), operator=(), and operator==().