#include <set_of.hh>
| Public Member Functions | |
| void | clear () | 
| Make the set empty. | |
| const E & | element (unsigned i) const | 
| Return the i-th element of the set. | |
| bool | has (const E &elt) const | 
| Test if the object eltbelongs to the set. | |
| set_of_< E > & | insert (const E &elt) | 
| Insert an element eltinto the set. | |
| bool | is_empty () const | 
| Test if the set is empty. | |
| unsigned | nelements () const | 
| Return the number of elements of the set. | |
| set_of_< E > & | remove (const E &elt) | 
| Remove an element eltinto the set. | |
| const std::vector< E > & | vect () const | 
| Give access to the set elements. | |
| Protected Member Functions | |
| set_of_ () | |
| Constructor without arguments. | |
| Protected Attributes | |
| std::set< E > | s_ | 
| Set of elements. | |
| Private Member Functions | |
| void | update_ () const | 
| Update v_ from s_. | |
| Private Attributes | |
| bool | needs_update_ | 
| Tell if v_ needs to be updated. | |
| std::vector< E > | v_ | 
| Array of 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.
E is the element type, which shall not be const-qualified.Definition at line 59 of file set_of.hh.
| set_of_ | ( | ) |  [inline, protected] | 
Constructor without arguments.
Print a set s into the output stream ostr.
| [in,out] | ostr | An output stream. | 
| [in] | s | A set. | 
ostr. Definition at line 187 of file set_of.hh.
References mln::internal::set_of_< E >::needs_update_.
| void mln::internal::set_of_< E >::clear | ( | ) |  [inline] | 
Make the set empty.
All elements contained in the set are destroyed so the set is emptied.
Definition at line 254 of file set_of.hh.
References mln::internal::set_of_< E >::is_empty(), mln::internal::set_of_< E >::needs_update_, mln::internal::set_of_< E >::s_, and mln::internal::set_of_< E >::v_.
| const E & mln::internal::set_of_< E >::element | ( | unsigned | i | ) | const  [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 217 of file set_of.hh.
References mln::internal::set_of_< E >::needs_update_, mln::internal::set_of_< E >::update_(), and mln::internal::set_of_< E >::v_.
| bool mln::internal::set_of_< E >::has | ( | const E & | elt | ) | const  [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 238 of file set_of.hh.
References mln::internal::set_of_< E >::s_.
| set_of_< E > & mln::internal::set_of_< E >::insert | ( | const E & | elt | ) |  [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 195 of file set_of.hh.
References mln::internal::set_of_< E >::needs_update_, and mln::internal::set_of_< E >::s_.
| bool mln::internal::set_of_< E >::is_empty | ( | ) | const  [inline] | 
Test if the set is empty.
Definition at line 246 of file set_of.hh.
References mln::internal::set_of_< E >::nelements().
Referenced by mln::internal::set_of_< E >::clear().
| unsigned mln::internal::set_of_< E >::nelements | ( | ) | const  [inline] | 
Return the number of elements of the set.
Definition at line 228 of file set_of.hh.
References mln::internal::set_of_< E >::needs_update_, mln::internal::set_of_< E >::update_(), and mln::internal::set_of_< E >::v_.
Referenced by mln::internal::set_of_< E >::is_empty().
| set_of_< E > & mln::internal::set_of_< E >::remove | ( | const E & | elt | ) |  [inline] | 
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.
Definition at line 206 of file set_of.hh.
References mln::internal::set_of_< E >::needs_update_, and mln::internal::set_of_< E >::s_.
| void mln::internal::set_of_< E >::update_ | ( | ) | const  [inline, private] | 
Update v_ from s_.
FIXME: explain.
Definition at line 275 of file set_of.hh.
References mln::internal::set_of_< E >::needs_update_, mln::internal::set_of_< E >::s_, and mln::internal::set_of_< E >::v_.
Referenced by mln::internal::set_of_< E >::element(), mln::internal::set_of_< E >::nelements(), and mln::internal::set_of_< E >::vect().
| const std::vector< E > & mln::internal::set_of_< E >::vect | ( | ) | const  [inline] | 
Give access to the set elements.
The complexity of this method is O(1).
Definition at line 265 of file set_of.hh.
References mln::internal::set_of_< E >::needs_update_, mln::internal::set_of_< E >::update_(), and mln::internal::set_of_< E >::v_.
| bool mln::internal::set_of_< E >::needs_update_  [mutable, private] | 
Tell if v_ needs to be updated.
Definition at line 163 of file set_of.hh.
Referenced by mln::internal::set_of_< E >::clear(), mln::internal::set_of_< E >::element(), mln::internal::set_of_< E >::insert(), mln::internal::set_of_< E >::nelements(), mln::internal::set_of_< E >::remove(), mln::internal::set_of_< E >::set_of_(), mln::internal::set_of_< E >::update_(), and mln::internal::set_of_< E >::vect().
| std::set<E> mln::internal::set_of_< E >::s_  [protected] | 
Set of elements.
This structure is always up-to-date w.r.t. the set contents.
Definition at line 153 of file set_of.hh.
Referenced by mln::internal::set_of_< E >::clear(), mln::internal::set_of_< E >::has(), mln::internal::set_of_< E >::insert(), mln::internal::set_of_< E >::remove(), and mln::internal::set_of_< E >::update_().
| std::vector<E> mln::internal::set_of_< E >::v_  [mutable, private] | 
Array of elements.
This structure is only updated (if required) when elements are accessed.
Definition at line 146 of file set_of.hh.
Referenced by mln::internal::set_of_< E >::clear(), mln::internal::set_of_< E >::element(), mln::internal::set_of_< E >::nelements(), mln::internal::set_of_< E >::update_(), and mln::internal::set_of_< E >::vect().
 1.7.1
 1.7.1