piranha  0.10
Public Types | Public Member Functions | List of all members
piranha::hash_set< T, Hash, Pred > Class Template Reference

Hash set. More...

#include <piranha/hash_set.hpp>

Public Types

using hasher = Hash
 Functor type for the calculation of hash values.
 
using key_equal = Pred
 Functor type for comparing the items in the set.
 
using key_type = T
 Key type.
 
using size_type = std::size_t
 Size type. More...
 
using iterator = iterator_impl< key_type const >
 Iterator type. More...
 
using const_iterator = iterator
 Const iterator type. More...
 
using local_iterator = typename list::const_iterator
 Local iterator. More...
 

Public Member Functions

 hash_set (const hasher &h=hasher{}, const key_equal &k=key_equal{})
 Default constructor. More...
 
 hash_set (const size_type &n_buckets, const hasher &h=hasher{}, const key_equal &k=key_equal{}, unsigned n_threads=1u)
 Constructor from number of buckets. More...
 
 hash_set (const hash_set &other)
 Copy constructor. More...
 
 hash_set (hash_set &&other) noexcept
 Move constructor. More...
 
template<typename InputIterator >
 hash_set (const InputIterator &begin, const InputIterator &end, const size_type &n_buckets=0u, const hasher &h=hasher{}, const key_equal &k=key_equal{})
 Constructor from range. More...
 
template<typename U >
 hash_set (std::initializer_list< U > list)
 Constructor from initializer list. More...
 
 ~hash_set ()
 Destructor. More...
 
hash_setoperator= (const hash_set &other)
 Copy assignment operator. More...
 
hash_setoperator= (hash_set &&other) noexcept
 Move assignment operator. More...
 
const_iterator begin () const
 Const begin iterator. More...
 
const_iterator end () const
 Const end iterator. More...
 
iterator begin ()
 Begin iterator. More...
 
iterator end ()
 End iterator. More...
 
size_type size () const
 Number of elements contained in the set. More...
 
bool empty () const
 Test for empty set. More...
 
size_type bucket_count () const
 Number of buckets. More...
 
double load_factor () const
 Load factor. More...
 
size_type bucket (const key_type &k) const
 Index of destination bucket. More...
 
const_iterator find (const key_type &k) const
 Find element. More...
 
iterator find (const key_type &k)
 Find element. More...
 
double max_load_factor () const
 Maximum load factor. More...
 
template<typename U , insert_enabler< U > = 0>
std::pair< iterator, bool > insert (U &&k)
 Insert element. More...
 
iterator erase (const_iterator it)
 Erase element. More...
 
void clear ()
 Remove all elements. More...
 
void swap (hash_set &other)
 Swap content. More...
 
void rehash (const size_type &new_size, unsigned n_threads=1u)
 Rehash set. More...
 
std::map< size_type, size_typeevaluate_sparsity () const
 Get information on the sparsity of the set. More...
 

Low-level interface

Low-level methods and types.

using _m_iterator = iterator_impl< key_type >
 Mutable iterator. More...
 
_m_iterator _m_begin ()
 Mutable begin iterator. More...
 
_m_iterator _m_end ()
 Mutable end iterator. More...
 
template<typename U , insert_enabler< U > = 0>
iterator _unique_insert (U &&k, const size_type &bucket_idx)
 Insert unique element (low-level). More...
 
const_iterator _find (const key_type &k, const size_type &bucket_idx) const
 Find element (low-level). More...
 
size_type _bucket_from_hash (const std::size_t &hash) const
 Index of destination bucket from hash value. More...
 
size_type _bucket (const key_type &k) const
 Index of destination bucket (low-level). More...
 
void _update_size (const size_type &new_size)
 Force update of the number of elements. More...
 
void _increase_size ()
 Increase bucket count. More...
 
const list & _get_bucket_list (const size_type &idx) const
 Const reference to list in bucket. More...
 
local_iterator _erase (const_iterator it)
 Erase element. More...
 

Detailed Description

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
class piranha::hash_set< T, Hash, Pred >

Hash set.

Hash set class with interface similar to std::unordered_set. The main points of difference with respect to std::unordered_set are the following:

The implementation employs a separate chaining strategy consisting of an array of buckets, each one a singly linked list with the first node stored directly within the array (so that the first insertion in a bucket does not require any heap allocation).

An additional set of low-level methods is provided: such methods are suitable for use in high-performance and multi-threaded contexts, and, if misused, could lead to data corruption and other unpredictable errors.

Note that for performance reasons the implementation employs sizes that are powers of two. Hence, particular care should be taken that the hash function does not exhibit commensurabilities with powers of 2.

Type requirements

Exception safety guarantee

This class provides the strong exception safety guarantee for all operations apart from methods involving insertion, which provide the basic guarantee (after a failed insertion, the set will be left in an unspecified but valid state).

Move semantics

Move construction and move assignment will leave the moved-from object equivalent to an empty set whose hasher and equality predicate have been moved-from.

Definition at line 122 of file hash_set.hpp.

Member Typedef Documentation

◆ _m_iterator

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
using piranha::hash_set< T, Hash, Pred >::_m_iterator = iterator_impl<key_type>

Mutable iterator.

This iterator type provides non-const access to the elements of the set. Please note that modifications to an existing element of the set might invalidate the relation between the element and its position in the set. After such modifications of one or more elements, the only valid operation is hash_set::clear() (destruction of the set before calling hash_set::clear() will lead to assertion failures in debug mode).

Definition at line 1212 of file hash_set.hpp.

◆ const_iterator

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
using piranha::hash_set< T, Hash, Pred >::const_iterator = iterator

Const iterator type.

Equivalent to the iterator type.

Definition at line 663 of file hash_set.hpp.

◆ iterator

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
using piranha::hash_set< T, Hash, Pred >::iterator = iterator_impl<key_type const>

Iterator type.

A read-only forward iterator.

Definition at line 652 of file hash_set.hpp.

◆ local_iterator

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
using piranha::hash_set< T, Hash, Pred >::local_iterator = typename list::const_iterator

Local iterator.

Const iterator that can be used to iterate through a single bucket.

Definition at line 668 of file hash_set.hpp.

◆ size_type

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
using piranha::hash_set< T, Hash, Pred >::size_type = std::size_t

Size type.

Alias for std::size_t.

Definition at line 384 of file hash_set.hpp.

Constructor & Destructor Documentation

◆ hash_set() [1/6]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
piranha::hash_set< T, Hash, Pred >::hash_set ( const hasher h = hasher{},
const key_equal k = key_equal{} 
)
inline

Default constructor.

If not specified, it will default-initialise the hasher and the equality predicate. The resulting hash set will be empty.

Parameters
hhasher functor.
kequality predicate.
Exceptions
unspecifiedany exception thrown by the copy constructors of Hash or Pred.

Definition at line 679 of file hash_set.hpp.

◆ hash_set() [2/6]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
piranha::hash_set< T, Hash, Pred >::hash_set ( const size_type n_buckets,
const hasher h = hasher{},
const key_equal k = key_equal{},
unsigned  n_threads = 1u 
)
inlineexplicit

Constructor from number of buckets.

Will construct a set whose number of buckets is at least equal to n_buckets. If n_threads is not 1, then the first n_threads threads from piranha::thread_pool will be used concurrently for the initialisation of the set.

Parameters
n_bucketsdesired number of buckets.
hhasher functor.
kequality predicate.
n_threadsnumber of threads to use during initialisation.
Exceptions
std::bad_allocif the desired number of buckets is greater than an implementation-defined maximum, or in case of memory errors.
std::invalid_argumentif n_threads is zero.
unspecifiedany exception thrown by:

Definition at line 702 of file hash_set.hpp.

◆ hash_set() [3/6]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
piranha::hash_set< T, Hash, Pred >::hash_set ( const hash_set< T, Hash, Pred > &  other)
inline

Copy constructor.

The hasher, the equality comparator and the allocator will also be copied.

Parameters
otherpiranha::hash_set that will be copied into this.
Exceptions
unspecifiedany exception thrown by memory allocation errors, the copy constructor of the stored type, Hash or Pred.

Definition at line 717 of file hash_set.hpp.

◆ hash_set() [4/6]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
piranha::hash_set< T, Hash, Pred >::hash_set ( hash_set< T, Hash, Pred > &&  other)
inlinenoexcept

Move constructor.

After the move, other will have zero buckets and zero elements, and its hasher and equality predicate will have been used to move-construct their counterparts in this.

Parameters
otherset to be moved.

Definition at line 756 of file hash_set.hpp.

◆ hash_set() [5/6]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
template<typename InputIterator >
piranha::hash_set< T, Hash, Pred >::hash_set ( const InputIterator &  begin,
const InputIterator &  end,
const size_type n_buckets = 0u,
const hasher h = hasher{},
const key_equal k = key_equal{} 
)
inlineexplicit

Constructor from range.

Create a set with a copy of a range.

Parameters
beginbegin of range.
endend of range.
n_bucketsnumber of initial buckets.
hhash functor.
kkey equality predicate.
Exceptions
std::bad_allocif the desired number of buckets is greater than an implementation-defined maximum.
unspecifiedany exception thrown by the copy constructors of Hash or Pred, or arising from calling insert() on the elements of the range.

Definition at line 780 of file hash_set.hpp.

◆ hash_set() [6/6]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
template<typename U >
piranha::hash_set< T, Hash, Pred >::hash_set ( std::initializer_list< U >  list)
inlineexplicit

Constructor from initializer list.

Will insert() all the elements of the initializer list, ignoring the return value of the operation. Hash functor and equality predicate will be default-constructed.

Parameters
listinitializer list of elements to be inserted.
Exceptions
std::bad_allocif the desired number of buckets is greater than an implementation-defined maximum.
unspecifiedany exception thrown by either insert() or of the default constructor of Hash or Pred.

Definition at line 801 of file hash_set.hpp.

◆ ~hash_set()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
piranha::hash_set< T, Hash, Pred >::~hash_set ( )
inline

Destructor.

No side effects.

Definition at line 814 of file hash_set.hpp.

Member Function Documentation

◆ _bucket()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
size_type piranha::hash_set< T, Hash, Pred >::_bucket ( const key_type k) const
inline

Index of destination bucket (low-level).

Equivalent to bucket(), with the exception that this method will not check if the number of buckets is zero.

Parameters
kinput argument.
Returns
index of the destination bucket for k.
Exceptions
unspecifiedany exception thrown by the call operator of the hasher.

Definition at line 1331 of file hash_set.hpp.

◆ _bucket_from_hash()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
size_type piranha::hash_set< T, Hash, Pred >::_bucket_from_hash ( const std::size_t &  hash) const
inline

Index of destination bucket from hash value.

Note that this method will not check if the number of buckets is zero.

Parameters
hashinput hash value.
Returns
index of the destination bucket for an object with hash value hash.

Definition at line 1315 of file hash_set.hpp.

◆ _erase()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
local_iterator piranha::hash_set< T, Hash, Pred >::_erase ( const_iterator  it)
inline

Erase element.

Erase the element to which it points. it must be a valid iterator pointing to an element of the set.

Erasing an element invalidates all iterators pointing to elements in the same bucket as the erased element.

This method will not update the number of elements in the set, nor it will try to access elements outside the bucket to which it refers.

Parameters
ititerator to the element of the set to be removed.
Returns
local iterator pointing to the element following it prior to the element being erased, or local end() if no such element exists.

Definition at line 1394 of file hash_set.hpp.

◆ _find()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
const_iterator piranha::hash_set< T, Hash, Pred >::_find ( const key_type k,
const size_type bucket_idx 
) const
inline

Find element (low-level).

Locate element in the set. The parameter bucket_idx is the index of the destination bucket for k and, for a set with a nonzero number of buckets, must be equal to the output of bucket() before the insertion. This method will not check if the value of bucket_idx is correct.

Parameters
kelement to be located.
bucket_idxindex of the destination bucket for k.
Returns
hash_set::iterator to k's position in the set, or end() if k is not in the set.
Exceptions
unspecifiedany exception thrown by calling the equality predicate.

Definition at line 1291 of file hash_set.hpp.

◆ _get_bucket_list()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
const list& piranha::hash_set< T, Hash, Pred >::_get_bucket_list ( const size_type idx) const
inline

Const reference to list in bucket.

Parameters
idxindex of the bucket whose list will be returned.
Returns
a const reference to the list of items contained in the bucket positioned at index idx.

Definition at line 1372 of file hash_set.hpp.

◆ _increase_size()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
void piranha::hash_set< T, Hash, Pred >::_increase_size ( )
inline

Increase bucket count.

Increase the number of buckets to the next implementation-defined value.

Exceptions
std::bad_allocif the operation results in a resize of the set past an implementation-defined maximum number of buckets.
unspecifiedany exception thrown by rehash().

Definition at line 1353 of file hash_set.hpp.

◆ _m_begin()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
_m_iterator piranha::hash_set< T, Hash, Pred >::_m_begin ( )
inline

Mutable begin iterator.

Returns
hash_set::_m_iterator to the beginning of the set.

Definition at line 1217 of file hash_set.hpp.

◆ _m_end()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
_m_iterator piranha::hash_set< T, Hash, Pred >::_m_end ( )
inline

Mutable end iterator.

Returns
hash_set::_m_iterator to the end of the set.

Definition at line 1241 of file hash_set.hpp.

◆ _unique_insert()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
template<typename U , insert_enabler< U > = 0>
iterator piranha::hash_set< T, Hash, Pred >::_unique_insert ( U &&  k,
const size_type bucket_idx 
)
inline

Insert unique element (low-level).

Note
This template method is activated only if T and U are the same type, aside from cv qualifications and references.

The parameter bucket_idx is the index of the destination bucket for k and, for a set with a nonzero number of buckets, must be equal to the output of bucket() before the insertion.

This method will not check if a key equivalent to k already exists in the set, it will not update the number of elements present in the set after the insertion, it will not resize the set in case the maximum load factor is exceeded, nor it will check if the value of bucket_idx is correct.

Parameters
kobject that will be inserted into the set.
bucket_idxdestination bucket for k.
Returns
iterator pointing to the newly-inserted element.
Exceptions
unspecifiedany exception thrown by the copy constructor of hash_set::key_type or by memory allocation errors.

Definition at line 1269 of file hash_set.hpp.

◆ _update_size()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
void piranha::hash_set< T, Hash, Pred >::_update_size ( const size_type new_size)
inline

Force update of the number of elements.

After this call, size() will return new_size regardless of the true number of elements in the set.

Parameters
new_sizenew set size.

Definition at line 1341 of file hash_set.hpp.

◆ begin() [1/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
const_iterator piranha::hash_set< T, Hash, Pred >::begin ( ) const
inline

Const begin iterator.

Returns
hash_set::const_iterator to the first element of the set, or end() if the set is empty.

Definition at line 859 of file hash_set.hpp.

◆ begin() [2/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
iterator piranha::hash_set< T, Hash, Pred >::begin ( )
inline

Begin iterator.

Returns
hash_set::iterator to the first element of the set, or end() if the set is empty.

Definition at line 891 of file hash_set.hpp.

◆ bucket()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
size_type piranha::hash_set< T, Hash, Pred >::bucket ( const key_type k) const
inline

Index of destination bucket.

Index to which k would belong, were it to be inserted into the set. The index of the destination bucket is the hash value reduced modulo the bucket count.

Parameters
kinput argument.
Returns
index of the destination bucket for k.
Exceptions
piranha::zero_division_errorif bucket_count() returns zero.
unspecifiedany exception thrown by _bucket().

Definition at line 948 of file hash_set.hpp.

◆ bucket_count()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
size_type piranha::hash_set< T, Hash, Pred >::bucket_count ( ) const
inline

Number of buckets.

Returns
number of buckets in the set.

Definition at line 923 of file hash_set.hpp.

◆ clear()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
void piranha::hash_set< T, Hash, Pred >::clear ( )
inline

Remove all elements.

After this call, size() and bucket_count() will both return zero.

Definition at line 1106 of file hash_set.hpp.

◆ empty()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
bool piranha::hash_set< T, Hash, Pred >::empty ( ) const
inline

Test for empty set.

Returns
true if size() returns 0, false otherwise.

Definition at line 915 of file hash_set.hpp.

◆ end() [1/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
const_iterator piranha::hash_set< T, Hash, Pred >::end ( ) const
inline

Const end iterator.

Returns
hash_set::const_iterator to the position past the last element of the set.

Definition at line 883 of file hash_set.hpp.

◆ end() [2/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
iterator piranha::hash_set< T, Hash, Pred >::end ( )
inline

End iterator.

Returns
hash_set::iterator to the position past the last element of the set.

Definition at line 899 of file hash_set.hpp.

◆ erase()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
iterator piranha::hash_set< T, Hash, Pred >::erase ( const_iterator  it)
inline

Erase element.

Erase the element to which it points. it must be a valid iterator pointing to an element of the set.

Erasing an element invalidates all iterators pointing to elements in the same bucket as the erased element.

After the operation has taken place, the size() of the set will be decreased by one.

Parameters
ititerator to the element of the set to be removed.
Returns
iterator pointing to the element following it prior to the element being erased, or end() if no such element exists.

Definition at line 1065 of file hash_set.hpp.

◆ evaluate_sparsity()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
std::map<size_type, size_type> piranha::hash_set< T, Hash, Pred >::evaluate_sparsity ( ) const
inline

Get information on the sparsity of the set.

Returns
an std::map<size_type,size_type> in which the key is the number of elements stored in a bucket and the mapped type the number of buckets containing those many elements.
Exceptions
unspecifiedany exception thrown by memory errors in standard containers.

Definition at line 1186 of file hash_set.hpp.

◆ find() [1/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
const_iterator piranha::hash_set< T, Hash, Pred >::find ( const key_type k) const
inline

Find element.

Parameters
kelement to be located.
Returns
hash_set::const_iterator to k's position in the set, or end() if k is not in the set.
Exceptions
unspecifiedany exception thrown by _find() or by _bucket().

Definition at line 963 of file hash_set.hpp.

◆ find() [2/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
iterator piranha::hash_set< T, Hash, Pred >::find ( const key_type k)
inline

Find element.

Parameters
kelement to be located.
Returns
hash_set::iterator to k's position in the set, or end() if k is not in the set.
Exceptions
unspecifiedany exception thrown by _find().

Definition at line 978 of file hash_set.hpp.

◆ insert()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
template<typename U , insert_enabler< U > = 0>
std::pair<iterator, bool> piranha::hash_set< T, Hash, Pred >::insert ( U &&  k)
inline

Insert element.

Note
This template method is activated only if T and U are the same type, aside from cv qualifications and references.

If no other key equivalent to k exists in the set, the insertion is successful and returns the (it,true) pair - where it is the position in the set into which the object has been inserted. Otherwise, the return value will be (it,false) - where it is the position of the existing equivalent object.

Parameters
kobject that will be inserted into the set.
Returns
(hash_set::iterator,bool) pair containing an iterator to the newly-inserted object (or its existing equivalent) and the result of the operation.
Exceptions
unspecifiedany exception thrown by:
std::overflow_errorif a successful insertion would result in size() exceeding the maximum value representable by type piranha::hash_set::size_type.
std::bad_allocif the operation results in a resize of the set past an implementation-defined maximum number of buckets.

Definition at line 1020 of file hash_set.hpp.

◆ load_factor()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
double piranha::hash_set< T, Hash, Pred >::load_factor ( ) const
inline

Load factor.

Returns
(double)size() / bucket_count(), or 0 if the set is empty.

Definition at line 931 of file hash_set.hpp.

◆ max_load_factor()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
double piranha::hash_set< T, Hash, Pred >::max_load_factor ( ) const
inline

Maximum load factor.

Returns
the maximum load factor allowed before a resize.

Definition at line 986 of file hash_set.hpp.

◆ operator=() [1/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
hash_set& piranha::hash_set< T, Hash, Pred >::operator= ( const hash_set< T, Hash, Pred > &  other)
inline

Copy assignment operator.

Parameters
otherassignment argument.
Returns
reference to this.
Exceptions
unspecifiedany exception thrown by the copy constructor.

Definition at line 827 of file hash_set.hpp.

◆ operator=() [2/2]

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
hash_set& piranha::hash_set< T, Hash, Pred >::operator= ( hash_set< T, Hash, Pred > &&  other)
inlinenoexcept

Move assignment operator.

Parameters
otherset to be moved into this.
Returns
reference to this.

Definition at line 841 of file hash_set.hpp.

◆ rehash()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
void piranha::hash_set< T, Hash, Pred >::rehash ( const size_type new_size,
unsigned  n_threads = 1u 
)
inline

Rehash set.

Change the number of buckets in the set to at least new_size. No rehash is performed if rehashing would lead to exceeding the maximum load factor. If n_threads is not 1, then the first n_threads threads from piranha::thread_pool will be used concurrently during the rehash operation.

Parameters
new_sizenew desired number of buckets.
n_threadsnumber of threads to use.
Exceptions
std::invalid_argumentif n_threads is zero.
unspecifiedany exception thrown by the constructor from number of buckets, _unique_insert() or _bucket().

Definition at line 1142 of file hash_set.hpp.

◆ size()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
size_type piranha::hash_set< T, Hash, Pred >::size ( ) const
inline

Number of elements contained in the set.

Returns
number of elements in the set.

Definition at line 907 of file hash_set.hpp.

◆ swap()

template<typename T, typename Hash = std::hash<T>, typename Pred = std::equal_to<T>>
void piranha::hash_set< T, Hash, Pred >::swap ( hash_set< T, Hash, Pred > &  other)
inline

Swap content.

Will use std::swap to swap hasher and equality predicate.

Parameters
otherswap argument.
Exceptions
unspecifiedany exception thrown by swapping hasher or equality predicate via std::swap.

Definition at line 1122 of file hash_set.hpp.


The documentation for this class was generated from the following file: