57#include <initializer_list>
61#ifndef DOXYGEN_SHOULD_SKIP_THIS
63 template <
typename Key >
65 template <
typename Key >
67 template <
typename Key >
70 template <
typename Key >
72 template <
typename Key >
128 template <
typename Key >
169 Set(std::initializer_list< Key > list);
309 template <
typename... Args >
509 template < typename NewKey >
525 template < typename NewKey >
536 template < typename NewKey >
591 template < typename Key >
610 enum class Position :
unsigned char { BEGIN, END };
622#ifndef DOXYGEN_SHOULD_SKIP_THIS
730 const Key& operator*() const;
741 const Key* operator->() const;
805 template < typename Key >
824 enum class Position :
unsigned char { BEGIN, END };
836#ifndef DOXYGEN_SHOULD_SKIP_THIS
855 explicit SetIterator(
const Set< Key >& from, Position pos = Position::BEGIN);
872 ~SetIterator() noexcept;
931 const Key& operator*() const;
942 const Key* operator->() const;
968 template < typename Key >
969 std::ostream& operator<<(
std::ostream&, const
Set< Key >&);
972 template < typename T >
986#ifndef DOXYGEN_SHOULD_SKIP_THIS
998 inline constexpr const void*
const _Set_end_ = &_static_Set_end_;
999 inline constexpr const void*
const _Set_end_safe_ = &_static_Set_end_safe_;
1005#if !defined(GUM_NO_EXTERN_TEMPLATE_CLASS) && !defined(SWIG)
Unsafe Const Iterators for hashtables.
All hash functions should inherit from this class.
static Size castToSize(const Set< T > &key)
Returns the value of a key as a Size.
Size operator()(const Set< T > &key) const final
computes the hashed value of a key
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=Position::BEGIN)
Creates an iterator for a given set.
SetIteratorSafe()
Default constructor: the iterator points toward nothing.
Position
An enumeration to position the iterator at the beginning or the end of the set.
const value_type * const_pointer
Types for STL compliance.
SetIteratorSafe(const SetIterator< Key > &iter)
Copy constructor.
Key value_type
Types for STL compliance.
value_type * pointer
Types for STL compliance.
HashTableConstIteratorSafe< const Tensor< GUM_SCALAR > *, bool > _ht_iter_
SetIteratorSafe(const SetIteratorSafe< Key > &from)
Copy constructor.
const value_type & const_reference
Types for STL compliance.
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.
SetIteratorSafe(SetIteratorSafe< Key > &&from) noexcept
Move constructor.
~SetIteratorSafe() noexcept
Class destructor.
Unsafe iterators for the Set class.
void clear() noexcept
makes the iterator point toward nothing (in particular, it is not related anymore to its current set)...
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.
HashTableConstIterator< Key, bool > _ht_iter_
The underlying iterator for the set's hash table containing the data.
SetIterator() noexcept
Default constructor: the iterator points toward nothing.
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< Key > & operator=(Set< Key > &&from) noexcept
Move operator.
Set(Size capacity=HashTableConst::default_size, bool resize_policy=true)
Default constructor.
bool isSupersetOrEqual(const Set< Edge > &s) const
SetIterator< Key > const_iterator
Types for STL compliance.
SetIteratorSafe< Key > const_iterator_safe
Types for STL compliance.
const Set< Key > & operator*=(const Set< Key > &s2)
Intersection update operator.
HashTable< Edge, bool > _inside_
void erase(const iterator_safe &k)
Erases an element from the set.
bool contains(const Edge &k) const
static const const_iterator_safe & cendSafe() noexcept
Key & reference
Types for STL compliance.
void insert(Key &&k)
Inserts a new element into the set.
const Key & const_reference
Types for STL compliance.
static const iterator & end() noexcept
List< NewKey > listMap(NewKey(*f)(const Edge &)) const
Set(std::initializer_list< Key > list)
Initializer list constructor.
Key popFirst()
Removes and returns an arbitrary element from the set.
bool isSubsetOrEqual(const Set< Edge > &s) const
const_iterator cbegin() const
Key * pointer
Types for STL compliance.
Set(const Set< Key > &aHT)
Copy constructor.
Set< Key > operator+(const Set< Key > &s2) const
Union operator.
void setResizePolicy(const bool new_policy)
void resize(Size new_capacity)
bool exists(const Edge &k) const
Key value_type
Types for STL compliance.
void clear()
Removes all the elements, if any, from the set.
bool resizePolicy() const
Set< Key > & operator<<(const Key &k)
Adds a new element to the set (alias for insert).
bool empty() const noexcept
bool isStrictSupersetOf(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.
SetIterator< Key > iterator
Types for STL compliance.
const_iterator_safe cbeginSafe() const
SetIteratorSafe< Key > iterator_safe
Types for STL compliance.
std::size_t size_type
Types for STL compliance.
void emplace(Args &&... args)
Emplace a new element in the set.
void insert(const Key &k)
Inserts a new element into the set.
const Set< Key > & operator+=(const Set< Key > &s2)
Union update operator.
bool isStrictSubsetOf(const Set< Edge > &s) const
iterator_safe beginSafe() const
HashTable< Edge, NewKey > hashMap(NewKey(*f)(const Edge &), Size capacity=0) const
Set< Key > & operator>>(const Key &k)
Removes an element from the set (alias for erase).
bool operator==(const Set< Key > &s2) const
Mathematical equality between two sets.
friend class SetIterator< Key >
Friends to speed up access.
void erase(const Key &k)
Erases an element from the set.
Set(Set< Key > &&aHT) noexcept
Move constructor.
Size size() const noexcept
Returns the number of elements in the set.
const Key * const_pointer
Types for STL compliance.
static const iterator_safe & endSafe() noexcept
std::ptrdiff_t difference_type
Types for STL compliance.
std::string toString() const
static const const_iterator & cend() noexcept
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.