Template Class unordered_set

Class Documentation

template <class Key, class Hash = shad::hash<Key>>
class unordered_set

Distributed unordered set.

A distributed associative container that contains a set of unique objects of type Key. Search, insertion, and removal have average constant-time complexity. Internally, the elements are not sorted in any particular order, but organized into buckets. Which bucket an element is placed into depends entirely on the hash of its value. This allows fast access to individual elements, since once a hash is computed, it refers to the exact bucket the element is placed into.

Template Parameters
  • Key: The type of the elements.
  • Hash: The type of the hashing callable.

Public Types

template<>
using key_type = Key
template<>
using value_type = typename set_t::value_type

The type of the stored value.

template<>
using size_type = std::size_t

The type used to represent size.

template<>
using difference_type = std::ptrdiff_t

The type used to represent distances.

template<>
using pointer = value_type *

The type for pointer to ::value_type.

template<>
using const_pointer = const value_type *

The type for pointer to ::const_value_type.

template<>
using iterator = typename set_t::iterator

The type of iterators on the set.

template<>
using const_iterator = typename set_t::const_iterator

The type of const iterators on the set.

template<>
using local_iterator = typename set_t::local_iterator

The type of local iterators on the set.

template<>
using const_local_iterator = typename set_t::const_local_iterator

The type of const local iterators on the set.

Public Functions

unordered_set(size_type bucket_count = 1021, const Hash &hash = Hash())

Constructor.

Parameters
  • bucket_count: The minimum number of buckets.
  • hash: The hashing callable.

~unordered_set()

Destructor.

iterator begin()
const_iterator begin() const

The iterator to the beginning of the sequence.

Return
a ::const_iterator to the beginning of the sequence.

const_iterator cbegin() const

The iterator to the beginning of the sequence.

Return
a ::const_iterator to the beginning of the sequence.

iterator end()

The iterator to the end of the sequence.

Return
an ::iterator to the end of the sequence.

const_iterator end() const

The iterator to the end of the sequence.

Return
a ::const_iterator to the end of the sequence.

const_iterator cend() const

The iterator to the end of the sequence.

Return
a ::const_iterator to the end of the sequence.

bool empty() const
size_type size() const

The size of the container.

Return
the size of the container.

std::pair<iterator, bool> insert(const value_type &value)
iterator insert(const_iterator hint, const value_type &value)

Inserts an element into the container, if the container does not already contain an element with an equivalent key.

Return
an iterator to the inserted element, or to the element that prevented the insertion.
Parameters
  • value: The value to be inserted.