EnTT 3.15.0
Loading...
Searching...
No Matches
entt::dense_set< Type, Hash, KeyEqual, Allocator > Class Template Reference

Associative container for unique objects of a given type. More...

#include <dense_set.hpp>

Public Types

using allocator_type = Allocator
 Allocator type.
 
using key_type = Type
 Key type of the container.
 
using value_type = Type
 Value type of the container.
 
using size_type = std::size_t
 Unsigned integer type.
 
using difference_type = std::ptrdiff_t
 Signed integer type.
 
using hasher = Hash
 Type of function to use to hash the elements.
 
using key_equal = KeyEqual
 Type of function to use to compare the elements for equality.
 
using iterator = internal::dense_set_iterator<typename packed_container_type::iterator>
 Random access iterator type.
 
using const_iterator = internal::dense_set_iterator<typename packed_container_type::const_iterator>
 Constant random access iterator type.
 
using reverse_iterator = std::reverse_iterator<iterator>
 Reverse iterator type.
 
using const_reverse_iterator = std::reverse_iterator<const_iterator>
 Constant reverse iterator type.
 
using local_iterator = internal::dense_set_local_iterator<typename packed_container_type::iterator>
 Forward iterator type.
 
using const_local_iterator = internal::dense_set_local_iterator<typename packed_container_type::const_iterator>
 Constant forward iterator type.
 

Public Member Functions

 dense_set ()
 Default constructor.
 
 dense_set (const allocator_type &allocator)
 Constructs an empty container with a given allocator.
 
 dense_set (const size_type cnt, const allocator_type &allocator)
 Constructs an empty container with a given allocator and user supplied minimal number of buckets.
 
 dense_set (const size_type cnt, const hasher &hash, const allocator_type &allocator)
 Constructs an empty container with a given allocator, hash function and user supplied minimal number of buckets.
 
 dense_set (const size_type cnt, const hasher &hash=hasher{}, const key_equal &equal=key_equal{}, const allocator_type &allocator=allocator_type{})
 Constructs an empty container with a given allocator, hash function, compare function and user supplied minimal number of buckets.
 
 dense_set (const dense_set &)=default
 Default copy constructor.
 
 dense_set (const dense_set &other, const allocator_type &allocator)
 Allocator-extended copy constructor.
 
 dense_set (dense_set &&) noexcept=default
 Default move constructor.
 
 dense_set (dense_set &&other, const allocator_type &allocator)
 Allocator-extended move constructor.
 
 ~dense_set ()=default
 Default destructor.
 
dense_setoperator= (const dense_set &)=default
 Default copy assignment operator.
 
dense_setoperator= (dense_set &&) noexcept=default
 Default move assignment operator.
 
void swap (dense_set &other) noexcept
 Exchanges the contents with those of a given container.
 
constexpr allocator_type get_allocator () const noexcept
 Returns the associated allocator.
 
const_iterator cbegin () const noexcept
 Returns an iterator to the beginning.
 
const_iterator begin () const noexcept
 Returns an iterator to the beginning.
 
iterator begin () noexcept
 Returns an iterator to the beginning.
 
const_iterator cend () const noexcept
 Returns an iterator to the end.
 
const_iterator end () const noexcept
 Returns an iterator to the end.
 
iterator end () noexcept
 Returns an iterator to the end.
 
const_reverse_iterator crbegin () const noexcept
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator rbegin () const noexcept
 Returns a reverse iterator to the beginning.
 
reverse_iterator rbegin () noexcept
 Returns a reverse iterator to the beginning.
 
const_reverse_iterator crend () const noexcept
 Returns a reverse iterator to the end.
 
const_reverse_iterator rend () const noexcept
 Returns a reverse iterator to the end.
 
reverse_iterator rend () noexcept
 Returns a reverse iterator to the end.
 
bool empty () const noexcept
 Checks whether a container is empty.
 
size_type size () const noexcept
 Returns the number of elements in a container.
 
size_type max_size () const noexcept
 Returns the maximum possible number of elements.
 
void clear () noexcept
 Clears the container.
 
std::pair< iterator, bool > insert (const value_type &value)
 Inserts an element into the container, if it does not exist.
 
std::pair< iterator, bool > insert (value_type &&value)
 Inserts an element into the container, if it does not exist.
 
template<typename It>
void insert (It first, It last)
 Inserts elements into the container, if they do not exist.
 
template<typename... Args>
std::pair< iterator, bool > emplace (Args &&...args)
 Constructs an element in-place, if it does not exist.
 
iterator erase (const_iterator pos)
 Removes an element from a given position.
 
iterator erase (const_iterator first, const_iterator last)
 Removes the given elements from a container.
 
size_type erase (const value_type &value)
 Removes the element associated with a given value.
 
size_type count (const value_type &key) const
 Returns the number of elements matching a value (either 1 or 0).
 
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, size_type > > count (const Other &key) const
 Returns the number of elements matching a key (either 1 or 0).
 
iterator find (const value_type &value)
 Finds an element with a given value.
 
const_iterator find (const value_type &value) const
 Finds an element with a given value.
 
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, iterator > > find (const Other &value)
 Finds an element that compares equivalent to a given value.
 
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, const_iterator > > find (const Other &value) const
 Finds an element with a given value.
 
std::pair< iterator, iteratorequal_range (const value_type &value)
 Returns a range containing all elements with a given value.
 
std::pair< const_iterator, const_iteratorequal_range (const value_type &value) const
 Returns a range containing all elements with a given value.
 
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, std::pair< iterator, iterator > > > equal_range (const Other &value)
 Returns a range containing all elements that compare equivalent to a given value.
 
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, std::pair< const_iterator, const_iterator > > > equal_range (const Other &value) const
 Returns a range containing all elements with a given value.
 
bool contains (const value_type &value) const
 Checks if the container contains an element with a given value.
 
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, bool > > contains (const Other &value) const
 Checks if the container contains an element that compares equivalent to a given value.
 
const_local_iterator cbegin (const size_type index) const
 Returns an iterator to the beginning of a given bucket.
 
const_local_iterator begin (const size_type index) const
 Returns an iterator to the beginning of a given bucket.
 
local_iterator begin (const size_type index)
 Returns an iterator to the beginning of a given bucket.
 
const_local_iterator cend (const size_type index) const
 Returns an iterator to the end of a given bucket.
 
const_local_iterator end (const size_type index) const
 Returns an iterator to the end of a given bucket.
 
local_iterator end (const size_type index)
 Returns an iterator to the end of a given bucket.
 
size_type bucket_count () const
 Returns the number of buckets.
 
size_type max_bucket_count () const
 Returns the maximum number of buckets.
 
size_type bucket_size (const size_type index) const
 Returns the number of elements in a given bucket.
 
size_type bucket (const value_type &value) const
 Returns the bucket for a given element.
 
float load_factor () const
 Returns the average number of elements per bucket.
 
float max_load_factor () const
 Returns the maximum average number of elements per bucket.
 
void max_load_factor (const float value)
 Sets the desired maximum average number of elements per bucket.
 
void rehash (const size_type cnt)
 Reserves at least the specified number of buckets and regenerates the hash table.
 
void reserve (const size_type cnt)
 Reserves space for at least the specified number of elements and regenerates the hash table.
 
hasher hash_function () const
 Returns the function used to hash the elements.
 
key_equal key_eq () const
 Returns the function used to compare elements for equality.
 

Detailed Description

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
class entt::dense_set< Type, Hash, KeyEqual, Allocator >

Associative container for unique objects of a given type.

Internally, elements are organized into buckets. Which bucket an element is placed into depends entirely on its hash. Elements with the same hash code appear in the same bucket.

Template Parameters
TypeValue type of the associative container.
HashType of function to use to hash the values.
KeyEqualType of function to use to compare the values for equality.
AllocatorType of allocator used to manage memory and elements.

Definition at line 220 of file dense_set.hpp.

Member Typedef Documentation

◆ allocator_type

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::allocator_type = Allocator

Allocator type.

Definition at line 291 of file dense_set.hpp.

◆ const_iterator

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::const_iterator = internal::dense_set_iterator<typename packed_container_type::const_iterator>

Constant random access iterator type.

Definition at line 307 of file dense_set.hpp.

◆ const_local_iterator

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::const_local_iterator = internal::dense_set_local_iterator<typename packed_container_type::const_iterator>

Constant forward iterator type.

Definition at line 315 of file dense_set.hpp.

◆ const_reverse_iterator

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Constant reverse iterator type.

Definition at line 311 of file dense_set.hpp.

◆ difference_type

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::difference_type = std::ptrdiff_t

Signed integer type.

Definition at line 299 of file dense_set.hpp.

◆ hasher

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::hasher = Hash

Type of function to use to hash the elements.

Definition at line 301 of file dense_set.hpp.

◆ iterator

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::iterator = internal::dense_set_iterator<typename packed_container_type::iterator>

Random access iterator type.

Definition at line 305 of file dense_set.hpp.

◆ key_equal

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::key_equal = KeyEqual

Type of function to use to compare the elements for equality.

Definition at line 303 of file dense_set.hpp.

◆ key_type

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::key_type = Type

Key type of the container.

Definition at line 293 of file dense_set.hpp.

◆ local_iterator

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::local_iterator = internal::dense_set_local_iterator<typename packed_container_type::iterator>

Forward iterator type.

Definition at line 313 of file dense_set.hpp.

◆ reverse_iterator

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::reverse_iterator = std::reverse_iterator<iterator>

Reverse iterator type.

Definition at line 309 of file dense_set.hpp.

◆ size_type

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::size_type = std::size_t

Unsigned integer type.

Definition at line 297 of file dense_set.hpp.

◆ value_type

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
using entt::dense_set< Type, Hash, KeyEqual, Allocator >::value_type = Type

Value type of the container.

Definition at line 295 of file dense_set.hpp.

Constructor & Destructor Documentation

◆ dense_set() [1/7]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
entt::dense_set< Type, Hash, KeyEqual, Allocator >::dense_set ( )
inline

Default constructor.

Definition at line 318 of file dense_set.hpp.

◆ dense_set() [2/7]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
entt::dense_set< Type, Hash, KeyEqual, Allocator >::dense_set ( const allocator_type & allocator)
inlineexplicit

Constructs an empty container with a given allocator.

Parameters
allocatorThe allocator to use.

Definition at line 325 of file dense_set.hpp.

◆ dense_set() [3/7]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
entt::dense_set< Type, Hash, KeyEqual, Allocator >::dense_set ( const size_type cnt,
const allocator_type & allocator )
inline

Constructs an empty container with a given allocator and user supplied minimal number of buckets.

Parameters
cntMinimal number of buckets.
allocatorThe allocator to use.

Definition at line 334 of file dense_set.hpp.

◆ dense_set() [4/7]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
entt::dense_set< Type, Hash, KeyEqual, Allocator >::dense_set ( const size_type cnt,
const hasher & hash,
const allocator_type & allocator )
inline

Constructs an empty container with a given allocator, hash function and user supplied minimal number of buckets.

Parameters
cntMinimal number of buckets.
hashHash function to use.
allocatorThe allocator to use.

Definition at line 344 of file dense_set.hpp.

◆ dense_set() [5/7]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
entt::dense_set< Type, Hash, KeyEqual, Allocator >::dense_set ( const size_type cnt,
const hasher & hash = hasher{},
const key_equal & equal = key_equal{},
const allocator_type & allocator = allocator_type{} )
inlineexplicit

Constructs an empty container with a given allocator, hash function, compare function and user supplied minimal number of buckets.

Parameters
cntMinimal number of buckets.
hashHash function to use.
equalCompare function to use.
allocatorThe allocator to use.

Definition at line 355 of file dense_set.hpp.

◆ dense_set() [6/7]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
entt::dense_set< Type, Hash, KeyEqual, Allocator >::dense_set ( const dense_set< Type, Hash, KeyEqual, Allocator > & other,
const allocator_type & allocator )
inline

Allocator-extended copy constructor.

Parameters
otherThe instance to copy from.
allocatorThe allocator to use.

Definition at line 369 of file dense_set.hpp.

◆ dense_set() [7/7]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
entt::dense_set< Type, Hash, KeyEqual, Allocator >::dense_set ( dense_set< Type, Hash, KeyEqual, Allocator > && other,
const allocator_type & allocator )
inline

Allocator-extended move constructor.

Parameters
otherThe instance to move from.
allocatorThe allocator to use.

Definition at line 382 of file dense_set.hpp.

Member Function Documentation

◆ begin() [1/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::begin ( ) const
inlinenodiscardnoexcept

Returns an iterator to the beginning.

If the array is empty, the returned iterator will be equal to end().

Returns
An iterator to the first instance of the internal array.

Definition at line 433 of file dense_set.hpp.

◆ begin() [2/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::begin ( )
inlinenodiscardnoexcept

Returns an iterator to the beginning.

If the array is empty, the returned iterator will be equal to end().

Returns
An iterator to the first instance of the internal array.

Definition at line 438 of file dense_set.hpp.

◆ begin() [3/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
local_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::begin ( const size_type index)
inlinenodiscard

Returns an iterator to the beginning of a given bucket.

Parameters
indexAn index of a bucket to access.
Returns
An iterator to the beginning of the given bucket.

Definition at line 780 of file dense_set.hpp.

◆ begin() [4/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_local_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::begin ( const size_type index) const
inlinenodiscard

Returns an iterator to the beginning of a given bucket.

Parameters
indexAn index of a bucket to access.
Returns
An iterator to the beginning of the given bucket.

Definition at line 771 of file dense_set.hpp.

◆ bucket()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::bucket ( const value_type & value) const
inlinenodiscard

Returns the bucket for a given element.

Parameters
valueThe value of the element to examine.
Returns
The bucket for the given element.

Definition at line 841 of file dense_set.hpp.

◆ bucket_count()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::bucket_count ( ) const
inlinenodiscard

Returns the number of buckets.

Returns
The number of buckets.

Definition at line 815 of file dense_set.hpp.

◆ bucket_size()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::bucket_size ( const size_type index) const
inlinenodiscard

Returns the number of elements in a given bucket.

Parameters
indexThe index of the bucket to examine.
Returns
The number of elements in the given bucket.

Definition at line 832 of file dense_set.hpp.

◆ cbegin() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::cbegin ( ) const
inlinenodiscardnoexcept

Returns an iterator to the beginning.

If the array is empty, the returned iterator will be equal to end().

Returns
An iterator to the first instance of the internal array.

Definition at line 428 of file dense_set.hpp.

◆ cbegin() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_local_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::cbegin ( const size_type index) const
inlinenodiscard

Returns an iterator to the beginning of a given bucket.

Parameters
indexAn index of a bucket to access.
Returns
An iterator to the beginning of the given bucket.

Definition at line 762 of file dense_set.hpp.

◆ cend() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::cend ( ) const
inlinenodiscardnoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last instance of the internal array.

Definition at line 447 of file dense_set.hpp.

◆ cend() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_local_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::cend ( const size_type index) const
inlinenodiscard

Returns an iterator to the end of a given bucket.

Parameters
indexAn index of a bucket to access.
Returns
An iterator to the end of the given bucket.

Definition at line 789 of file dense_set.hpp.

◆ clear()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
void entt::dense_set< Type, Hash, KeyEqual, Allocator >::clear ( )
inlinenoexcept

Clears the container.

Definition at line 526 of file dense_set.hpp.

◆ contains() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, bool > > entt::dense_set< Type, Hash, KeyEqual, Allocator >::contains ( const Other & value) const
inlinenodiscard

Checks if the container contains an element that compares equivalent to a given value.

Template Parameters
OtherType of an element to search for.
Parameters
valueValue of an element to search for.
Returns
True if there is such an element, false otherwise.

Definition at line 753 of file dense_set.hpp.

◆ contains() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
bool entt::dense_set< Type, Hash, KeyEqual, Allocator >::contains ( const value_type & value) const
inlinenodiscard

Checks if the container contains an element with a given value.

Parameters
valueValue of an element to search for.
Returns
True if there is such an element, false otherwise.

Definition at line 740 of file dense_set.hpp.

◆ count() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, size_type > > entt::dense_set< Type, Hash, KeyEqual, Allocator >::count ( const Other & key) const
inlinenodiscard

Returns the number of elements matching a key (either 1 or 0).

Template Parameters
OtherType of the key value of an element to search for.
Parameters
keyKey value of an element to search for.
Returns
Number of elements matching the key (either 1 or 0).

Definition at line 656 of file dense_set.hpp.

◆ count() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::count ( const value_type & key) const
inlinenodiscard

Returns the number of elements matching a value (either 1 or 0).

Parameters
keyKey value of an element to search for.
Returns
Number of elements matching the key (either 1 or 0).

Definition at line 644 of file dense_set.hpp.

◆ crbegin()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_reverse_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::crbegin ( ) const
inlinenodiscardnoexcept

Returns a reverse iterator to the beginning.

If the array is empty, the returned iterator will be equal to rend().

Returns
An iterator to the first instance of the reversed internal array.

Definition at line 468 of file dense_set.hpp.

◆ crend()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_reverse_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::crend ( ) const
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last instance of the reversed internal array.

Definition at line 487 of file dense_set.hpp.

◆ emplace()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename... Args>
std::pair< iterator, bool > entt::dense_set< Type, Hash, KeyEqual, Allocator >::emplace ( Args &&... args)
inline

Constructs an element in-place, if it does not exist.

The element is also constructed when the container already has the key, in which case the newly constructed object is destroyed immediately.

Template Parameters
ArgsTypes of arguments to forward to the constructor of the element.
Parameters
argsArguments to forward to the constructor of the element.
Returns
A pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.

Definition at line 575 of file dense_set.hpp.

◆ empty()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
bool entt::dense_set< Type, Hash, KeyEqual, Allocator >::empty ( ) const
inlinenodiscardnoexcept

Checks whether a container is empty.

Returns
True if the container is empty, false otherwise.

Definition at line 505 of file dense_set.hpp.

◆ end() [1/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::end ( ) const
inlinenodiscardnoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last instance of the internal array.

Definition at line 452 of file dense_set.hpp.

◆ end() [2/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::end ( )
inlinenodiscardnoexcept

Returns an iterator to the end.

Returns
An iterator to the element following the last instance of the internal array.

Definition at line 457 of file dense_set.hpp.

◆ end() [3/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
local_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::end ( const size_type index)
inlinenodiscard

Returns an iterator to the end of a given bucket.

Parameters
indexAn index of a bucket to access.
Returns
An iterator to the end of the given bucket.

Definition at line 807 of file dense_set.hpp.

◆ end() [4/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_local_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::end ( const size_type index) const
inlinenodiscard

Returns an iterator to the end of a given bucket.

Parameters
indexAn index of a bucket to access.
Returns
An iterator to the end of the given bucket.

Definition at line 798 of file dense_set.hpp.

◆ equal_range() [1/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, std::pair< iterator, iterator > > > entt::dense_set< Type, Hash, KeyEqual, Allocator >::equal_range ( const Other & value)
inlinenodiscard

Returns a range containing all elements that compare equivalent to a given value.

Template Parameters
OtherType of an element to search for.
Parameters
valueValue of an element to search for.
Returns
A pair of iterators pointing to the first element and past the last element of the range.

Definition at line 722 of file dense_set.hpp.

◆ equal_range() [2/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, std::pair< const_iterator, const_iterator > > > entt::dense_set< Type, Hash, KeyEqual, Allocator >::equal_range ( const Other & value) const
inlinenodiscard

Returns a range containing all elements with a given value.

Parameters
valueValue of an element to search for.
Returns
A pair of iterators pointing to the first element and past the last element of the range.

Definition at line 730 of file dense_set.hpp.

◆ equal_range() [3/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
std::pair< iterator, iterator > entt::dense_set< Type, Hash, KeyEqual, Allocator >::equal_range ( const value_type & value)
inlinenodiscard

Returns a range containing all elements with a given value.

Parameters
valueValue of an element to search for.
Returns
A pair of iterators pointing to the first element and past the last element of the range.

Definition at line 701 of file dense_set.hpp.

◆ equal_range() [4/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
std::pair< const_iterator, const_iterator > entt::dense_set< Type, Hash, KeyEqual, Allocator >::equal_range ( const value_type & value) const
inlinenodiscard

Returns a range containing all elements with a given value.

Parameters
valueValue of an element to search for.
Returns
A pair of iterators pointing to the first element and past the last element of the range.

Definition at line 707 of file dense_set.hpp.

◆ erase() [1/3]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::erase ( const value_type & value)
inline

Removes the element associated with a given value.

Parameters
valueValue of an element to remove.
Returns
Number of elements removed (either 0 or 1).

Definition at line 626 of file dense_set.hpp.

◆ erase() [2/3]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::erase ( const_iterator first,
const_iterator last )
inline

Removes the given elements from a container.

Parameters
firstAn iterator to the first element of the range of elements.
lastAn iterator past the last element of the range of elements.
Returns
An iterator following the last removed element.

Definition at line 611 of file dense_set.hpp.

◆ erase() [3/3]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::erase ( const_iterator pos)
inline

Removes an element from a given position.

Parameters
posAn iterator to the element to remove.
Returns
An iterator following the removed element.

Definition at line 599 of file dense_set.hpp.

◆ find() [1/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, iterator > > entt::dense_set< Type, Hash, KeyEqual, Allocator >::find ( const Other & value)
inlinenodiscard

Finds an element that compares equivalent to a given value.

Template Parameters
OtherType of an element to search for.
Parameters
valueValue of an element to search for.
Returns
An iterator to an element with the given value. If no such element is found, a past-the-end iterator is returned.

Definition at line 684 of file dense_set.hpp.

◆ find() [2/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename Other>
std::enable_if_t< is_transparent_v< hasher > &&is_transparent_v< key_equal >, std::conditional_t< false, Other, const_iterator > > entt::dense_set< Type, Hash, KeyEqual, Allocator >::find ( const Other & value) const
inlinenodiscard

Finds an element with a given value.

Parameters
valueValue of an element to search for.
Returns
An iterator to an element with the given value. If no such element is found, a past-the-end iterator is returned.

Definition at line 691 of file dense_set.hpp.

◆ find() [3/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::find ( const value_type & value)
inlinenodiscard

Finds an element with a given value.

Parameters
valueValue of an element to search for.
Returns
An iterator to an element with the given value. If no such element is found, a past-the-end iterator is returned.

Definition at line 666 of file dense_set.hpp.

◆ find() [4/4]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::find ( const value_type & value) const
inlinenodiscard

Finds an element with a given value.

Parameters
valueValue of an element to search for.
Returns
An iterator to an element with the given value. If no such element is found, a past-the-end iterator is returned.

Definition at line 671 of file dense_set.hpp.

◆ get_allocator()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
allocator_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::get_allocator ( ) const
inlinenodiscardconstexprnoexcept

Returns the associated allocator.

Returns
The associated allocator.

Definition at line 417 of file dense_set.hpp.

◆ hash_function()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
hasher entt::dense_set< Type, Hash, KeyEqual, Allocator >::hash_function ( ) const
inlinenodiscard

Returns the function used to hash the elements.

Returns
The function used to hash the elements.

Definition at line 909 of file dense_set.hpp.

◆ insert() [1/3]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
std::pair< iterator, bool > entt::dense_set< Type, Hash, KeyEqual, Allocator >::insert ( const value_type & value)
inline

Inserts an element into the container, if it does not exist.

Parameters
valueAn element to insert into the container.
Returns
A pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.

Definition at line 539 of file dense_set.hpp.

◆ insert() [2/3]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
template<typename It>
void entt::dense_set< Type, Hash, KeyEqual, Allocator >::insert ( It first,
It last )
inline

Inserts elements into the container, if they do not exist.

Template Parameters
ItType of input iterator.
Parameters
firstAn iterator to the first element of the range of elements.
lastAn iterator past the last element of the range of elements.

Definition at line 555 of file dense_set.hpp.

◆ insert() [3/3]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
std::pair< iterator, bool > entt::dense_set< Type, Hash, KeyEqual, Allocator >::insert ( value_type && value)
inline

Inserts an element into the container, if it does not exist.

Parameters
valueAn element to insert into the container.
Returns
A pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.

Definition at line 544 of file dense_set.hpp.

◆ key_eq()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
key_equal entt::dense_set< Type, Hash, KeyEqual, Allocator >::key_eq ( ) const
inlinenodiscard

Returns the function used to compare elements for equality.

Returns
The function used to compare elements for equality.

Definition at line 917 of file dense_set.hpp.

◆ load_factor()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
float entt::dense_set< Type, Hash, KeyEqual, Allocator >::load_factor ( ) const
inlinenodiscard

Returns the average number of elements per bucket.

Returns
The average number of elements per bucket.

Definition at line 849 of file dense_set.hpp.

◆ max_bucket_count()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::max_bucket_count ( ) const
inlinenodiscard

Returns the maximum number of buckets.

Returns
The maximum number of buckets.

Definition at line 823 of file dense_set.hpp.

◆ max_load_factor() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
float entt::dense_set< Type, Hash, KeyEqual, Allocator >::max_load_factor ( ) const
inlinenodiscard

Returns the maximum average number of elements per bucket.

Returns
The maximum average number of elements per bucket.

Definition at line 857 of file dense_set.hpp.

◆ max_load_factor() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
void entt::dense_set< Type, Hash, KeyEqual, Allocator >::max_load_factor ( const float value)
inline

Sets the desired maximum average number of elements per bucket.

Parameters
valueA desired maximum average number of elements per bucket.

Definition at line 865 of file dense_set.hpp.

◆ max_size()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::max_size ( ) const
inlinenodiscardnoexcept

Returns the maximum possible number of elements.

Returns
Maximum possible number of elements.

Definition at line 521 of file dense_set.hpp.

◆ operator=() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
dense_set & entt::dense_set< Type, Hash, KeyEqual, Allocator >::operator= ( const dense_set< Type, Hash, KeyEqual, Allocator > & )
default

Default copy assignment operator.

Returns
This container.

◆ operator=() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
dense_set & entt::dense_set< Type, Hash, KeyEqual, Allocator >::operator= ( dense_set< Type, Hash, KeyEqual, Allocator > && )
defaultnoexcept

Default move assignment operator.

Returns
This container.

◆ rbegin() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_reverse_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::rbegin ( ) const
inlinenodiscardnoexcept

Returns a reverse iterator to the beginning.

If the array is empty, the returned iterator will be equal to rend().

Returns
An iterator to the first instance of the reversed internal array.

Definition at line 473 of file dense_set.hpp.

◆ rbegin() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
reverse_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::rbegin ( )
inlinenodiscardnoexcept

Returns a reverse iterator to the beginning.

If the array is empty, the returned iterator will be equal to rend().

Returns
An iterator to the first instance of the reversed internal array.

Definition at line 478 of file dense_set.hpp.

◆ rehash()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
void entt::dense_set< Type, Hash, KeyEqual, Allocator >::rehash ( const size_type cnt)
inline

Reserves at least the specified number of buckets and regenerates the hash table.

Parameters
cntNew number of buckets.

Definition at line 876 of file dense_set.hpp.

◆ rend() [1/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
const_reverse_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::rend ( ) const
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last instance of the reversed internal array.

Definition at line 492 of file dense_set.hpp.

◆ rend() [2/2]

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
reverse_iterator entt::dense_set< Type, Hash, KeyEqual, Allocator >::rend ( )
inlinenodiscardnoexcept

Returns a reverse iterator to the end.

Returns
An iterator to the element following the last instance of the reversed internal array.

Definition at line 497 of file dense_set.hpp.

◆ reserve()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
void entt::dense_set< Type, Hash, KeyEqual, Allocator >::reserve ( const size_type cnt)
inline

Reserves space for at least the specified number of elements and regenerates the hash table.

Parameters
cntNew number of elements.

Definition at line 900 of file dense_set.hpp.

◆ size()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
size_type entt::dense_set< Type, Hash, KeyEqual, Allocator >::size ( ) const
inlinenodiscardnoexcept

Returns the number of elements in a container.

Returns
Number of elements in a container.

Definition at line 513 of file dense_set.hpp.

◆ swap()

template<typename Type, typename Hash, typename KeyEqual, typename Allocator>
void entt::dense_set< Type, Hash, KeyEqual, Allocator >::swap ( dense_set< Type, Hash, KeyEqual, Allocator > & other)
inlinenoexcept

Exchanges the contents with those of a given container.

Parameters
otherContainer to exchange the content with.

Definition at line 406 of file dense_set.hpp.


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