|
Milena (Olena)
User documentation 2.0a Id
|
An "efficient" mathematical set class. More...
#include <set.hh>

Public Types | |
| typedef set_bkd_iter< T > | bkd_eiter |
| Backward iterator associated type. | |
| typedef fwd_eiter | eiter |
| Iterator associated type. | |
| typedef T | element |
| Element associated type. | |
| typedef set_fwd_iter< T > | fwd_eiter |
| Forward iterator associated type. | |
Public Member Functions | |
| void | clear () |
| Empty the set. | |
| const T | first_element () const |
| Return the first element of the set. | |
| bool | has (const T &elt) const |
Test if the object elt belongs to the set. | |
| set< T > & | insert (const T &elt) |
Insert an element elt into the set. | |
| template<typename U > | |
| set< T > & | insert (const set< U > &other) |
Insert the elements of other into the set. | |
| bool | is_empty () const |
| Test if the set is empty. | |
| const T | last_element () const |
| Return the last element of the set. | |
| std::size_t | memory_size () const |
| Return the size of this set in memory. | |
| unsigned | nelements () const |
| Return the number of elements of the set. | |
| const T & | operator[] (unsigned i) const |
| Return the i-th element of the set. | |
| set< T > & | remove (const T &elt) |
Remove an element elt into the set. | |
| set () | |
| Constructor without arguments. | |
| const std::vector< T > & | std_vector () const |
| Give access to the set elements. | |
An "efficient" mathematical set class.
This set class is designed to store a mathematical set and to present it to the user as a linear array (std::vector).
Elements are stored by copy. Implementation is lazy.
The set has two states: frozen or not. There is an automatic switch of state when the user modifies its contents (insert, remove, or clear) or access to its contents (op[i]).
The parameter T is the element type, which shall not be const-qualified.
The unicity of set elements is handled by the mln::util::ord mechanism.
Definition at line 81 of file util/set.hh.
| typedef set_bkd_iter<T> mln::util::set< T >::bkd_eiter |
Backward iterator associated type.
Definition at line 93 of file util/set.hh.
| typedef fwd_eiter mln::util::set< T >::eiter |
Iterator associated type.
Definition at line 96 of file util/set.hh.
| typedef T mln::util::set< T >::element |
Element associated type.
Definition at line 86 of file util/set.hh.
| typedef set_fwd_iter<T> mln::util::set< T >::fwd_eiter |
Forward iterator associated type.
Definition at line 90 of file util/set.hh.
|
inline |
Constructor without arguments.
Definition at line 348 of file util/set.hh.
|
inline |
Empty the set.
All elements contained in the set are destroyed so the set is emptied.
Definition at line 390 of file util/set.hh.
|
inline |
Return the first element of the set.
Definition at line 427 of file util/set.hh.
|
inline |
Test if the object elt belongs to the set.
| [in] | elt | A possible element of the set. |
elt is in the set. Definition at line 445 of file util/set.hh.
|
inline |
Insert an element elt into the set.
| [in] | elt | The element to be inserted. |
If elt is already in the set, this method is a no-op.
Definition at line 356 of file util/set.hh.
Referenced by mln::p_key< K, P >::change_keys().
|
inline |
Insert the elements of other into the set.
| [in] | other | The set containing the elements to be inserted. |
Definition at line 367 of file util/set.hh.
References mln::util::set< T >::is_empty(), and mln::util::set< T >::std_vector().
|
inline |
Test if the set is empty.
Definition at line 453 of file util/set.hh.
Referenced by mln::util::set< T >::insert().
|
inline |
Return the last element of the set.
Definition at line 436 of file util/set.hh.
|
inline |
Return the size of this set in memory.
Definition at line 494 of file util/set.hh.
|
inline |
Return the number of elements of the set.
Definition at line 409 of file util/set.hh.
|
inline |
Return the i-th element of the set.
| [in] | i | Index of the element to retrieve. |
The element is returned by reference and is constant.
Definition at line 417 of file util/set.hh.
|
inline |
Remove an element elt into the set.
| [in] | elt | The element to be inserted. |
If elt is already in the set, this method is a no-op.
Definition at line 380 of file util/set.hh.
|
inline |
Give access to the set elements.
The complexity of this method is O(1).
Definition at line 461 of file util/set.hh.
Referenced by mln::util::set< T >::insert().