template<typename T, typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
class immer::set< T, Hash, Equal, MemoryPolicy, B >
Immutable set representing an unordered bag of values.
- Template Parameters
-
T | The type of the values to be stored in the container. |
Hash | The type of a function object capable of hashing values of type T . |
Equal | The type of a function object capable of comparing values of type T . |
MemoryPolicy | Memory management policy. See memory_policy. |
This cotainer provides a good trade-off between cache locality, membership checks, update performance and structural sharing. It does so by storing the data in contiguous chunks of :math:2^{B}
elements. When storing big objects, the size of these contiguous chunks can become too big, damaging performance. If this is measured to be problematic for a specific use-case, it can be solved by using a immer::box
to wrap the type T
.
Example .. literalinclude:: ../example/set/intro.cpp :language: c++ :start-after: intro/start :end-before: intro/end
Definition at line 61 of file set.hpp.
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
Returns a set containing value
. If the value
is already in the set, it returns the same set. It may allocate memory and its complexity is effectively .
Definition at line 128 of file set.hpp.
References immer::detail::hamts::champ< T, Hash, Equal, MemoryPolicy, B >::add(), and immer::set< T, Hash, Equal, MemoryPolicy, B >::impl_.
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
bool immer::set< T, Hash, Equal, MemoryPolicy, B >::operator== |
( |
const set< T, Hash, Equal, MemoryPolicy, B > & |
other | ) |
const |
|
inline |
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
template<typename T , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>, typename MemoryPolicy = default_memory_policy, detail::hamts::bits_t B = default_bits>
Definition at line 158 of file set.hpp.
Referenced by immer::set< T, Hash, Equal, MemoryPolicy, B >::begin(), immer::set< T, Hash, Equal, MemoryPolicy, B >::count(), immer::set< T, Hash, Equal, MemoryPolicy, B >::end(), immer::set< T, Hash, Equal, MemoryPolicy, B >::erase(), immer::set< T, Hash, Equal, MemoryPolicy, B >::impl(), immer::set< T, Hash, Equal, MemoryPolicy, B >::insert(), immer::set< T, Hash, Equal, MemoryPolicy, B >::operator==(), immer::set< T, Hash, Equal, MemoryPolicy, B >::size(), and immer::set< T, Hash, Equal, MemoryPolicy, B >::transient().