39 template <
typename Key >
45 template <
typename Key >
46 template <
typename Alloc >
50 :
set.__inside.cbeginSafe()} {
55 template <
typename Key >
63 template <
typename Key >
70 template <
typename Key >
72 __ht_iter{std::move(from.__ht_iter)} {
77 template <
typename Key >
83 template <
typename Key >
91 template <
typename Key >
99 template <
typename Key >
102 __ht_iter = std::move(from.__ht_iter);
107 template <
typename Key >
117 template <
typename Key >
125 template <
typename Key >
131 template <
typename Key >
134 return __ht_iter != from.__ht_iter;
139 template <
typename Key >
142 return __ht_iter == from.__ht_iter;
146 template <
typename Key >
150 return __ht_iter.key();
154 template <
typename Key >
158 return &(__ht_iter.key());
163 template <
typename Key >
173 template <
typename Key >
179 template <
typename Key >
180 template <
typename Alloc >
184 :
set.__inside.cbegin()} {
189 template <
typename Key >
196 template <
typename Key >
203 template <
typename Key >
209 template <
typename Key >
217 template <
typename Key >
225 template <
typename Key >
235 template <
typename Key >
242 template <
typename Key >
248 template <
typename Key >
256 template <
typename Key >
263 template <
typename Key >
271 template <
typename Key >
280 template <
typename Key >
290 template <
typename Key,
typename Alloc >
293 SetIteratorStaticEnd::endSafe4Statics()));
297 template <
typename Key,
typename Alloc >
300 SetIteratorStaticEnd::constEndSafe4Statics()));
304 template <
typename Key,
typename Alloc >
307 SetIteratorStaticEnd::end4Statics()));
311 template <
typename Key,
typename Alloc >
314 SetIteratorStaticEnd::constEnd4Statics()));
318 template <
typename Key,
typename Alloc >
323 __inside(capacity, resize_policy, false) {
324 GUM_CONSTRUCTOR(
Set);
332 template <
typename Key,
typename Alloc >
334 __inside(
Size(list.size()) / 2, true, false) {
335 GUM_CONSTRUCTOR(
Set);
336 for (
const auto& elt : list) {
346 template <
typename Key,
typename Alloc >
348 __inside(s.__inside) {
353 template <
typename Key,
typename Alloc >
354 template <
typename OtherAlloc >
356 __inside(s.__inside) {
361 template <
typename Key,
typename Alloc >
363 __inside(
std::move(s.__inside)) {
368 template <
typename Key,
typename Alloc >
374 template <
typename Key,
typename Alloc >
390 template <
typename Key,
typename Alloc >
420 template <
typename Key,
typename Alloc >
421 template <
typename OtherAlloc >
452 template <
typename Key,
typename Alloc >
454 __inside = std::move(from.__inside);
459 template <
typename Key,
typename Alloc >
460 template <
typename OtherAlloc >
465 if (size() != h2.
size())
return false;
469 iter != __inside.cend();
471 if (!h2.
exists(iter.key()))
return false;
478 template <
typename Key,
typename Alloc >
479 template <
typename OtherAlloc >
486 template <
typename Key,
typename Alloc >
493 template <
typename Key,
typename Alloc >
500 template <
typename Key,
typename Alloc >
504 SetIteratorStaticEnd::__SetIterEndSafe));
508 template <
typename Key,
typename Alloc >
512 SetIteratorStaticEnd::__SetIterEndSafe));
516 template <
typename Key,
typename Alloc >
522 template <
typename Key,
typename Alloc >
529 template <
typename Key,
typename Alloc >
533 SetIteratorStaticEnd::__SetIterEnd));
537 template <
typename Key,
typename Alloc >
541 SetIteratorStaticEnd::__SetIterEnd));
545 template <
typename Key,
typename Alloc >
551 template <
typename Key,
typename Alloc >
553 __inside.
resize(new_size);
563 template <
typename Key,
typename Alloc >
574 template <
typename Key,
typename Alloc >
580 template <
typename Key,
typename Alloc >
582 return __inside.
exists(k);
586 template <
typename Key,
typename Alloc >
587 template <
typename OtherAlloc >
590 if (this->size() >= s.
size()) {
return false; }
592 for (
const auto& elt : *
this) {
593 if (!s.
contains(elt)) {
return false; }
598 template <
typename Key,
typename Alloc >
599 template <
typename OtherAlloc >
606 template <
typename Key,
typename Alloc >
608 return __inside.
exists(k);
612 template <
typename Key,
typename Alloc >
630 template <
typename Key,
typename Alloc >
637 __inside.
insert(std::move(k),
true);
648 template <
typename Key,
typename Alloc >
649 template <
typename... Args >
651 insert(std::move(Key(std::forward< Args >(args)...)));
655 template <
typename Key,
typename Alloc >
667 template <
typename Key,
typename Alloc >
679 template <
typename Key,
typename Alloc >
686 template <
typename Key,
typename Alloc >
688 insert(std::move(k));
693 template <
typename Key,
typename Alloc >
700 template <
typename Key,
typename Alloc >
702 return __inside.
size();
706 template <
typename Key,
typename Alloc >
708 return __inside.
empty();
712 template <
typename Key,
typename Alloc >
713 template <
typename OtherAlloc >
720 if (size() < h2.
size()) {
722 iter != __inside.cend();
724 if (h2.
exists(iter.key())) h_r.
insert(iter.key(),
true);
730 if (__inside.exists(iter.key())) h_r.
insert(iter.key(),
true);
739 template <
typename Key,
typename Alloc >
740 template <
typename OtherAlloc >
745 for (
auto iter = __inside.beginSafe(); iter != __inside.endSafe(); ++iter) {
746 if (!h2.
exists(iter.key())) __inside.erase(iter);
755 template <
typename Key,
typename Alloc >
756 template <
typename OtherAlloc >
761 if (!__inside.exists(pair.first)) __inside.
insert(pair.first,
true);
770 template <
typename Key,
typename Alloc >
771 template <
typename OtherAlloc >
780 if (!h_r.
exists(iter.key())) h_r.
insert(iter.key(),
true);
788 template <
typename Key,
typename Alloc >
789 template <
typename OtherAlloc >
797 iter != __inside.cend();
799 if (!h2.
exists(iter.key())) h_r.
insert(iter.key(),
true);
805 template <
typename Key,
typename Alloc >
807 std::stringstream out;
811 for (
iterator iter = begin(); iter != end(); ++iter) {
828 template <
typename Key,
typename Alloc >
829 std::ostream& operator<<(std::ostream& stream, const Set< Key, Alloc >&
set) {
830 stream <<
set.toString();
835 template <
typename Key,
typename Alloc >
836 template <
typename NewKey,
typename NewAlloc >
842 if (size == 0) size = std::max(
Size(2), __inside.size() / 2);
849 iter != __inside.cend();
851 table.insert(iter.key(), f(iter.key()));
858 template <
typename Key,
typename Alloc >
859 template <
typename NewKey,
typename NewAlloc >
865 if (size == 0) size = std::max(
Size(2), __inside.size() / 2);
872 iter != __inside.cend();
874 table.insert(iter.key(), val);
881 template <
typename Key,
typename Alloc >
882 template <
typename NewKey,
typename NewAlloc >
890 iter != __inside.cend();
900 template <
typename T,
typename Alloc >
904 for (
const auto& k : key) {
913 template <
typename T,
typename Alloc >
916 return (castToSize(key) * HashFuncConst::gold) & this->_hash_mask;
bool contains(const Key &k) const
Indicates whether a given elements belong to the set.
const key_type & key() const
Returns the key corresponding to the element pointed to by the iterator.
bool empty() const noexcept
Indicates whether the set is the empty set.
SetIterator< Key > operator+(Size i) const noexcept
Returns a new iterator.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
static const const_iterator_safe & constEndSafe4Statics()
Returns the end iterator for other classes' statics (read the detailed description of this method)...
bool operator!=(const SetIterator< Key > &from) const noexcept
Indicates whether two iterators point to different elements or sets.
Safe iterators for the Set classDevelopers may consider using Set<x>::iterator_safe instead of SetIte...
Size capacity() const
Returns the capacity of the underlying hash table containing the set.
Size size() const noexcept
Returns the number of elements stored into the hashtable.
bool isSubsetOf(const Set< Key, OtherAlloc > &s) const
bool exists(const Key &key) const
Checks whether there exists an element with a given key in the hashtable.
Class template representing hashing function of LpCol.
void erase(const Key &k)
Erases an element from the set.
void clear() noexcept
Makes the iterator point toward nothing (in particular, it is not related anymore to its current hash...
Generic doubly linked lists.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool operator==(const SetIterator< Key > &from) const noexcept
Indicates whether two iterators point toward the same element of a same set.
The class for generic Hash Tables.
SetIterator() noexcept
Default constructor: the iterator points toward nothing.
std::istream & operator>>(std::istream &in, TiXmlNode &base)
Representation of a setA Set is a structure that contains arbitrary elements.
static const iterator & end4Statics()
Returns the end iterator for other classes' statics (read the detailed description of this method)...
HashTableConstIteratorSafe< Key, bool > __ht_iter
The underlying iterator for the set's hash table containing the data.
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
Position
An enumeration to position the iterator at the beginning or the end of the set.
std::ostream & operator<<(std::ostream &output, const BayesNet< GUM_SCALAR > &bn)
Prints map's DAG in output using the Graphviz-dot format.
void resize(Size new_capacity)
Changes the size of the underlying hash table containing the set.
HashTableConstIterator< Key, bool > __ht_iter
The underlying iterator for the set's hash table containing the data.
bool resizePolicy() const
Returns the current resizing policy of the underlying hash table.
Position
An enumeration to position the iterator at the beginning or the end of the set.
const const_iterator & cend() const noexcept
Returns the unsafe const_iterator pointing to the end of the hashtable.
LpExpr operator+(LpExpr &&lhs, const T2 &rhs)
Overload of operator + between anything ( a scalar, a variable or an expression ) and anything except...
Val & pushBack(const Val &val)
Inserts a new element (a copy) at the end of the chained list.
bool operator==(const TiXmlString &a, const TiXmlString &b)
void setResizePolicy(const bool new_policy)
Enables the user to change dynamically the resizing policy of the underlying hash table...
static const iterator_safe & endSafe4Statics()
Returns the end iterator for other classes' statics (read the detailed description of this method)...
SetIterator< Key > & operator+=(Size i) noexcept
Makes the iterator point to i elements further in the set.
void clear() noexcept
makes the iterator point toward nothing (in particular, it is not related anymore to its current set)...
friend class Set
Friends to speed up access.
const_iterator cbegin() const
Returns an unsafe const_iterator pointing to the beginning of the hashtable.
const Key * operator->() const
Returns a pointer to the element pointed to by the iterator.
Unsafe iterators for the Set class.
LpExpr operator*(const SCALAR &lhs, const LpCol &rhs)
Overload of operator * between a scalar and a variable.
SetIterator< Key > & operator++() noexcept
Increments the iterator.
bool operator!=(const TiXmlString &a, const TiXmlString &b)
void clear() noexcept
makes the iterator point toward nothing (in particular, it is not related anymore to its current set)...
HashTable< Key, bool, Alloc > __inside
A set of X's is actually a hash table whose keys are the X's.
~SetIterator() noexcept
Class destructor.
void clear()
Removes all the elements, if any, from the set.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
LpExpr operator-(LpExpr &&lhs, const T2 &rhs)
Overload of operator - between anything ( a scalar, a variable or an expression ) and anything except...
Size size() const noexcept
Returns the number of elements in the set.
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
SetIteratorSafe()
Default constructor: the iterator points toward nothing.
static const const_iterator & constEnd4Statics()
Returns the end iterator for other classes' statics (read the detailed description of this method)...
void insert(const Key &k)
Inserts a new element into the set.
const Key & operator*() const
Returns the element pointed to by the iterator.
SetIterator< Key > & operator=(const SetIterator< Key > &from) noexcept
Assignment operator.