59#include <initializer_list>
63#ifndef DOXYGEN_SHOULD_SKIP_THIS
65 template <
typename Key >
67 template <
typename Key >
69 template <
typename Key >
72 template <
typename Key >
74 template <
typename Key >
130 template <
typename Key >
171 Set(std::initializer_list< Key > list);
318 template <
typename... Args >
518 template < typename NewKey >
534 template < typename NewKey >
545 template < typename NewKey >
600 template < typename Key >
631#ifndef DOXYGEN_SHOULD_SKIP_THIS
743 const Key& operator*() const;
754 const Key* operator->() const;
818 template < typename Key >
849#ifndef DOXYGEN_SHOULD_SKIP_THIS
864 SetIterator(
const Set< Key >& from, Position pos = BEGIN);
881 ~SetIterator() noexcept;
894 SetIterator< Key >& operator=(const SetIterator< Key >& from) noexcept;
901 SetIterator< Key >& operator=(SetIterator< Key >&& from) noexcept;
907 SetIterator< Key >& operator++() noexcept;
914 SetIterator< Key >& operator+=(Size i) noexcept;
921 SetIterator< Key > operator+(Size i) const noexcept;
929 bool operator!=(const SetIterator< Key >& from) const noexcept;
937 bool operator==(const SetIterator< Key >& from) const noexcept;
948 const Key& operator*() const;
959 const Key* operator->() const;
985 template < typename Key >
986 std::ostream& operator<<(
std::ostream&, const
Set< Key >&);
989 template < typename T >
1003#ifndef DOXYGEN_SHOULD_SKIP_THIS
1015 inline constexpr void*
const _Set_end_ = (
void*
const)&_static_Set_end_;
1016 inline constexpr void*
const _Set_end_safe_ = (
void*
const)&_static_Set_end_safe_;
1022#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Unsafe Const Iterators for hashtables.
All hash functions should inherit from this class.
virtual Size operator()(const Set< T > &key) const override final
computes the hashed value of a key
static Size castToSize(const Set< T > &key)
Returns the value of a key as a Size.
This class should be useless as only its specializations should be used.
Safe Const Iterators for hashtables.
The class for generic Hash Tables.
Generic doubly linked lists.
Safe iterators for the Set class.
SetIteratorSafe(const Set< Key > &from, Position pos=BEGIN)
Creates an iterator for a given set.
const value_type * const_pointer
Types for STL compliance.
SetIteratorSafe()
Default constructor: the iterator points toward nothing.
~SetIteratorSafe() noexcept
Class destructor.
SetIteratorSafe(const SetIterator< Key > &from)
Copy constructor.
Key value_type
Types for STL compliance.
value_type * pointer
Types for STL compliance.
HashTableConstIteratorSafe< const Tensor< GUM_SCALAR > *, bool > _ht_iter_
const value_type & const_reference
Types for STL compliance.
SetIteratorSafe(const SetIteratorSafe< Key > &from)
Copy constructor.
SetIteratorSafe(SetIteratorSafe< Key > &&from)
Move constructor.
std::ptrdiff_t difference_type
Types for STL compliance.
std::forward_iterator_tag iterator_category
Types for STL compliance.
value_type & reference
Types for STL compliance.
Unsafe iterators for the Set class.
const value_type * const_pointer
Types for STL compliance.
std::forward_iterator_tag iterator_category
Types for STL compliance.
std::ptrdiff_t difference_type
Types for STL compliance.
value_type * pointer
Types for STL compliance.
SetIterator() noexcept
Default constructor: the iterator points toward nothing.
void clear() noexcept
makes the iterator point toward nothing (in particular, it is not related anymore to its current set)...
HashTableConstIterator< Key, bool > _ht_iter_
The underlying iterator for the set's hash table containing the data.
value_type & reference
Types for STL compliance.
Position
An enumeration to position the iterator at the beginning or the end of the set.
const value_type & const_reference
Types for STL compliance.
Key value_type
Types for STL compliance.
Set(std::initializer_list< Key > list)
Initializer list constructor.
Set(const Set< Key > &aHT)
Copy constructor.
SetIterator< Key > const_iterator
Types for STL compliance.
SetIteratorSafe< Key > const_iterator_safe
Types for STL compliance.
const iterator & end() const noexcept
const Set< Key > & operator*=(const Set< Key > &s2)
Intersection update operator.
HashTable< Edge, bool > _inside_
Key & reference
Types for STL compliance.
const Key & const_reference
Types for STL compliance.
Size size() const noexcept
Returns the number of elements in the set.
iterator_safe beginSafe() const
List< NewKey > listMap(NewKey(*f)(const Edge &)) const
Key popFirst()
Removes and returns an arbitrary element from the set.
Key * pointer
Types for STL compliance.
const iterator_safe & endSafe() const noexcept
Set< Key > operator+(const Set< Key > &s2) const
Union operator.
Key value_type
Types for STL compliance.
bool isSubsetOrEqual(const Set< Edge > &s) const
bool isSupersetOrEqual(const Set< Edge > &s) const
Set< Key > & operator=(const Set< Key > &from)
Copy operator.
friend class SetIteratorSafe< Key >
Friends to speed up access.
Set< Key > operator-(const Set< Key > &s2) const
Disjunction operator.
Set< Key > operator*(const Set< Key > &s2) const
Intersection operator.
const_iterator_safe cbeginSafe() const
std::string toString() const
Set(Size capacity=HashTableConst::default_size, bool resize_policy=true)
Default constructor.
bool resizePolicy() const
SetIterator< Key > iterator
Types for STL compliance.
bool isStrictSubsetOf(const Set< Edge > &s) const
Set< Key > & operator=(Set< Key > &&from)
Move operator.
SetIteratorSafe< Key > iterator_safe
Types for STL compliance.
const const_iterator & cend() const noexcept
std::size_t size_type
Types for STL compliance.
void emplace(Args &&... args)
Emplace a new element in the set.
void erase(const iterator_safe &k)
Erases an element from the set.
const Set< Key > & operator+=(const Set< Key > &s2)
Union update operator.
bool exists(const Edge &k) const
bool operator!=(const Set< Key > &s2) const
Mathematical inequality between two sets.
void setResizePolicy(const bool new_policy)
HashTable< Edge, NewKey > hashMap(NewKey(*f)(const Edge &), Size capacity=0) const
bool operator==(const Set< Key > &s2) const
Mathematical equality between two sets.
friend class SetIterator< Key >
Friends to speed up access.
bool isStrictSupersetOf(const Set< Edge > &s) const
bool contains(const Edge &k) const
Set< Key > & operator<<(const Key &k)
Adds a new element to the set (alias for insert).
void resize(Size new_capacity)
const_iterator cbegin() const
Set(Set< Key > &&aHT)
Move constructor.
void insert(const Key &k)
Inserts a new element into the set.
const const_iterator_safe & cendSafe() const noexcept
const Key * const_pointer
Types for STL compliance.
bool empty() const noexcept
Set< Key > & operator>>(const Key &k)
Removes an element from the set (alias for erase).
void insert(Key &&k)
Inserts a new element into the set.
void erase(const Key &k)
Erases an element from the set.
std::ptrdiff_t difference_type
Types for STL compliance.
void clear()
Removes all the elements, if any, from the set.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Class hash tables iterators.
Generic class for manipulating lists.
gum is the global namespace for all aGrUM entities
Implementation of the Set.
static constexpr Size default_size
The default number of slots in hashtables.