a set on a DICTIONARY D, an item being a key: a USet of Morin if D is a KeyedDictionary, an SSet if it is an OrderedDictionary
More...
#include <ADS/set/DictionarySet.h>
|
| using | Item = typename D::Key |
| | the type of the items
|
|
template<class... A>
requires std::constructible_from< D , A... > |
| | DictionarySet (A &&... a) |
| | the empty set on the dictionary D( a... )
|
| std::size_t | size (void) const |
| | the number of items, the keys of the dictionary
|
| bool | empty (void) const |
| | whether the set has no item
|
| bool | contains (const Item &x) const |
| | whether \( x \) is a key of the dictionary
|
| bool | insert (const Item &x) |
| | \( x \) into the set, as the key of the value true (or of the value made by default, for values that are not bool); true if it was not there
|
| bool | remove (const Item &x) |
| | \( x \) out of the set, the key removed from the dictionary
|
| const Item * | find (const Item &x) const |
| | the address of the item equal to \( x \), nil if none, by findKey() of the dictionary: the find( x ) of a USet of Morin
|
| const Item * | lowerBound (const Item &x) const |
| | the address of the smallest item not smaller than \( x \), nil if none, by lowerBoundKey() of the dictionary: the find( x ) of an SSet of Morin
|
| template<class F> |
| void | forEach (F &&f) const |
| | f( x ) on the items, in the order of the dictionary
|
| const D & | dictionary (void) const |
| | the dictionary
|
| auto | begin (void) const |
| | the iterator on the first key of the dictionary
|
| auto | end (void) const |
| | the iterator past the last key of the dictionary
|
template<class D>
class ADS::DictionarySet< D >
a set on a DICTIONARY D, an item being a key: a USet of Morin if D is a KeyedDictionary, an SSet if it is an OrderedDictionary
◆ Item
◆ DictionarySet()
template<class D>
template<class... A>
requires std::constructible_from< D , A... >
the empty set on the dictionary D( a... )
◆ begin()
the iterator on the first key of the dictionary
◆ contains()
whether \( x \) is a key of the dictionary
◆ dictionary()
◆ empty()
whether the set has no item
◆ end()
the iterator past the last key of the dictionary
◆ find()
the address of the item equal to \( x \), nil if none, by findKey() of the dictionary: the find( x ) of a USet of Morin
◆ forEach()
template<class D>
template<class F>
f( x ) on the items, in the order of the dictionary
◆ insert()
\( x \) into the set, as the key of the value true (or of the value made by default, for values that are not bool); true if it was not there
In pseudocode (section 8.4), \( D \) the dictionary:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{insert}( x )\quad \triangleright
\ \text{true if } x \text{ is new} \cr
2 & \quad \textbf{if}\ \text{the insertion of } D
\text{ tells whether the key was new}\ \textbf{then return}
\ D.\mathrm{insert}( x , \textbf{true} ) \cr
3 & \quad \mathit{fresh} \gets \textbf{not}\ \mathrm{contains}( x );
\ \textbf{if}\ \mathit{fresh}\ \textbf{then}\ D.\mathrm{insert}( x ,
\textbf{true} ) \cr
4 & \quad \textbf{return}\ \mathit{fresh}
\end{array}}
\]
- Postcondition
- \( x \) is in the set
◆ lowerBound()
the address of the smallest item not smaller than \( x \), nil if none, by lowerBoundKey() of the dictionary: the find( x ) of an SSet of Morin
◆ remove()
\( x \) out of the set, the key removed from the dictionary
In pseudocode (section 8.4):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{remove}( x )\quad \triangleright
\ \text{true if } x \text{ was there} \cr
2 & \quad \textbf{if}\ \text{the removal of } D
\text{ tells whether the key was there}\ \textbf{then return}
\ D.\mathrm{remove}( x ) \cr
3 & \quad \mathit{found} \gets \mathrm{contains}( x );\ \textbf{if}
\ \mathit{found}\ \textbf{then}\ D.\mathrm{remove}( x ) \cr
4 & \quad \textbf{return}\ \mathit{found}
\end{array}}
\]
- Postcondition
- \( x \) is not in the set
◆ size()
the number of items, the keys of the dictionary
The documentation for this class was generated from the following file: