$extrastylesheet
#include <mln/core/internal/set_of.hh>
Public Member Functions | |
void | clear () |
const E & | element (unsigned i) const |
bool | has (const E &elt) const |
set_of_< E > & | insert (const E &elt) |
bool | is_empty () const |
unsigned | nelements () const |
set_of_< E > & | remove (const E &elt) |
const std::vector< E > & | vect () const |
Protected Member Functions | |
set_of_ () |
Protected Attributes | |
std::set< E > | s_ |
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.
E
is the element type, which shall not be const-qualified.
|
protected |
Constructor without arguments.
void mln::internal::set_of_< E >::clear | ( | ) |
Make the set empty.
All elements contained in the set are destroyed so the set is emptied.
const E& mln::internal::set_of_< E >::element | ( | unsigned | i | ) | const |
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.
bool mln::internal::set_of_< E >::has | ( | const E & | elt | ) | const |
Test if the object elt
belongs to the set.
[in] | elt | A possible element of the set. |
elt
is in the set. set_of_<E>& mln::internal::set_of_< E >::insert | ( | const E & | elt | ) |
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.
bool mln::internal::set_of_< E >::is_empty | ( | ) | const |
Test if the set is empty.
unsigned mln::internal::set_of_< E >::nelements | ( | ) | const |
Return the number of elements of the set.
set_of_<E>& mln::internal::set_of_< E >::remove | ( | const E & | elt | ) |
Remove an element elt
into the set.
[in] | elt | The element to be deleted. |
If elt
is not in the set, this method is a no-op.
const std::vector<E>& mln::internal::set_of_< E >::vect | ( | ) | const |
Give access to the set elements.
The complexity of this method is O(1).
|
protected |