Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::inline_map< Key, Value, Capacity, Compare > Class Template Reference

A container similar to std::map that has a fixed capacity. More...

Inheritance diagram for arene::base::inline_map< Key, Value, Capacity, Compare >:
Inheritance graph

Public Types

using const_iterator = iterator_impl<true>
 The type of an iterator that provides const access to the elements.
 
using const_pointer = value_type const*
 The type of a const pointer to the value type of the map.
 
using const_reference = value_type const&
 The type of a const reference to the value type of the map.
 
using const_reverse_iterator = ::arene::base::reverse_iterator<const_iterator>
 The type of an iterator that provides const access to the elements and iterates in reverse through the elements.
 
using difference_type = typename iterator::difference_type
 The difference type of the map.
 
using inline_map_base_type = map_base_type
 inline_map_base type
 
using iterator = iterator_impl<false>
 The type of an iterator that provides non- const access to the elements.
 
using key_compare = typename map_base_type::compare_type
 The comparator of the map.
 
using key_type = typename map_base_type::key_type
 The key type of the map.
 
using mapped_type = typename map_base_type::mapped_type
 The mapped type of the map.
 
using pointer = value_type*
 The type of a pointer to the value type of the map.
 
using reference = value_type&
 The type of a reference to the value type of the map.
 
using reverse_iterator = ::arene::base::reverse_iterator<iterator>
 The type of an iterator that provides non- const access to the elements and iterates in reverse through the elements.
 
using size_type = typename map_base_type::size_type
 The size type of the map.
 
using value_type = typename map_base_type::value_type
 The value type of the map.
 

Public Member Functions

 inline_map ()=default
 Construct the map with a default-constructed comparator and no elements.
 
 inline_map (Compare const &compare) noexcept(std::is_nothrow_copy_constructible< Compare >::value)
 Construct the map with a copy of the specified comparator and no elements.
 
 inline_map (inline_map const &other)=default
 Copy the source map, so the new map has the same size, comparator and elements as the source.
 
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeCompare >::value > > = nullptr>
 inline_map (inline_map< Key, Value, OtherCapacity, Compare > &&other)
 Move from a map with a different capacity.
 
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeCompare >::value > > = nullptr>
 inline_map (inline_map< Key, Value, OtherCapacity, Compare > const &other)
 Copy from a map with a different capacity.
 
 inline_map (move_construct_source &&other) noexcept(std::is_nothrow_move_constructible< Compare >::value &&std::is_nothrow_copy_constructible< Key >::value &&std::is_nothrow_move_constructible< Value >::value)
 Move the source map into the new instance, so the new map has the same size, comparator and elements as the source did before-hand.
 
template<typename T = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_default_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< T >::value > > = nullptr>
 inline_map (std::initializer_list< value_type > init_list)
 Construct the map with a default-constructed comparator and copies of the elements from the provided initializer list.
 
template<typename T = Value, typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< T >::value >, std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
 inline_map (std::initializer_list< value_type > init_list, Compare const &compare)
 Construct the map with a copy of the specified comparator and copies of the elements from the provided initializer list.
 
 ~inline_map ()=default
 Default destructor.
 
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
ARENE_NODISCARD auto at (Key const &key) -> Value &
 Obtain a reference to the mapped value for the specified key or throw.
 
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
ARENE_NODISCARD auto at (Key const &key) const -> Value const &
 Obtain a reference to the mapped value for the specified key or throw.
 
template<typename OtherKey, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled >, std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
ARENE_NODISCARD auto at (OtherKey const &key) -> Value &
 Obtain a reference to the mapped value for the specified key or throw.
 
template<typename OtherKey, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled >, std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
ARENE_NODISCARD auto at (OtherKey const &key) const -> Value const &
 Obtain a reference to the mapped value for the specified key or throw.
 
ARENE_NODISCARD auto begin () const noexcept -> const_iterator
 Obtain an iterator referring to the beginning of the sorted range of elements.
 
ARENE_NODISCARD auto begin () noexcept -> iterator
 Obtain an iterator referring to the beginning of the sorted range of elements.
 
ARENE_NODISCARD auto cbegin () const noexcept -> const_iterator
 Obtain an iterator referring to the beginning of the sorted range of elements.
 
ARENE_NODISCARD auto cend () const noexcept -> const_iterator
 Obtain an iterator referring to one past the last element in the sorted range of elements.
 
void clear () noexcept
 Destroy all elements in *this and set the size to zero.
 
auto contains (Key const &key) const noexcept(comparison_is_noexcept<>) -> bool
 Check if the set contains a specific key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto contains (OtherKey const &key) const noexcept(comparison_is_noexcept< OtherKey >) -> bool
 Check if the set contains a key equivalent to a specific value.
 
auto count (Key const &key) const noexcept(comparison_is_noexcept<>) -> size_type
 Return the number of elements in the map equivalent to a specific key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto count (OtherKey const &key) const noexcept(comparison_is_noexcept< OtherKey >) -> size_type
 Return the number of elements in the map equivalent to a specific key.
 
ARENE_NODISCARD auto crbegin () const noexcept -> const_reverse_iterator
 Obtain an iterator referring to the beginning of a reversed traversal of the sorted range of elements.
 
ARENE_NODISCARD auto crend () const noexcept -> const_reverse_iterator
 Obtain an iterator referring to one past the last element in a reversed traversal of the sorted range of elements.
 
template<typename... Args, constraints< std::enable_if_t< std::is_constructible< value_type, Args &&... >::value > > = nullptr>
auto emplace (Args &&... args) -> std::pair< iterator, bool >
 Construct a new value_type object and try to insert it in the map if there is not already one with the corresponding key.
 
ARENE_NODISCARD auto empty () const noexcept -> bool
 Check if the map is empty.
 
ARENE_NODISCARD auto end () const noexcept -> const_iterator
 Obtain an iterator referring to one past the last element in the sorted range of elements.
 
ARENE_NODISCARD auto end () noexcept -> iterator
 Obtain an iterator referring to one past the last element in the sorted range of elements.
 
auto equal_range (Key const &key) const noexcept(comparison_is_noexcept<>) -> std::pair< const_iterator, const_iterator >
 Finds the sequence of elements whose keys compare equivalent to a given key.
 
auto equal_range (Key const &key) noexcept(comparison_is_noexcept<>) -> std::pair< iterator, iterator >
 Finds the sequence of elements whose keys compare equivalent to a given key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto equal_range (OtherKey const &key) const noexcept(comparison_is_noexcept< OtherKey >) -> std::pair< const_iterator, const_iterator >
 Finds the sequence of elements whose keys compare equivalent to a given key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto equal_range (OtherKey const &key) noexcept(comparison_is_noexcept< OtherKey >) -> std::pair< iterator, iterator >
 Finds the sequence of elements whose keys compare equivalent to a given key.
 
auto erase (const_iterator first, const_iterator last) noexcept -> iterator
 Erase all the elements in the specified iterator range.
 
auto erase (const_iterator pos) noexcept -> iterator
 Erase the element at the specified position.
 
auto erase (iterator pos) noexcept -> iterator
 Erase the element at the specified position.
 
auto erase (Key const &key) noexcept(comparison_is_noexcept<>) -> iterator
 Erase the element with the corresponding key, if there is one.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto erase (OtherKey const &key) noexcept(comparison_is_noexcept< OtherKey >) -> iterator
 Erase the element with the corresponding key, if there is one.
 
auto find (Key const &key) const noexcept(comparison_is_noexcept<>) -> const_iterator
 Obtain an iterator referring to the element equivalent to the supplied key, if there is one.
 
auto find (Key const &key) noexcept(comparison_is_noexcept<>) -> iterator
 Obtain an iterator referring to the element equivalent to the supplied key, if there is one.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto find (OtherKey const &key) const noexcept(comparison_is_noexcept< OtherKey >) -> const_iterator
 Obtain an iterator referring to the element equivalent to the supplied key, if there is one.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto find (OtherKey const &key) noexcept(comparison_is_noexcept< OtherKey >) -> iterator
 Obtain an iterator referring to the element equivalent to the supplied key, if there is one.
 
template<typename P, constraints< std::enable_if_t<!std::is_same< value_type, P >::value >, std::enable_if_t< std::is_constructible< value_type, P && >::value > > = nullptr>
auto insert (P &&value) -> std::pair< iterator, bool >
 Insert a new element in the map if there is not already one with the corresponding key.
 
template<typename SfinaeKey = Key, typename SfinaeValue = Value, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value > > = nullptr>
auto insert (value_type &&value) -> std::pair< iterator, bool >
 Insert a new element in the map if there is not already one with the corresponding key.
 
template<typename SfinaeKey = Key, typename SfinaeValue = Value, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value > > = nullptr>
auto insert (value_type const &value) -> std::pair< iterator, bool >
 Insert a new element in the map if there is not already one with the corresponding key.
 
template<typename OtherMapped, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_move_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, OtherMapped && >::value >, std::enable_if_t< std::is_assignable< Value &, OtherMapped && >::value > > = nullptr>
auto insert_or_assign (Key &&key, OtherMapped &&mapped_value) -> std::pair< iterator, bool >
 Insert a new element in the map if there is not already one with the corresponding key, otherwise assigns the new value to the existing one.
 
template<typename OtherMapped, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, OtherMapped && >::value >, std::enable_if_t< std::is_assignable< Value &, OtherMapped && >::value > > = nullptr>
auto insert_or_assign (Key const &key, OtherMapped &&mapped_value) -> std::pair< iterator, bool >
 Insert a new element in the map if there is not already one with the corresponding key, otherwise assigns the new value to the existing one.
 
template<typename OtherKey, typename OtherMapped, constraints< std::enable_if_t< transparent_insertion_supported< OtherKey > >, std::enable_if_t< std::is_constructible< Key, OtherKey && >::value >, std::enable_if_t< std::is_constructible< Value, OtherMapped && >::value >, std::enable_if_t< std::is_assignable< Value &, OtherMapped && >::value > > = nullptr>
auto insert_or_assign (OtherKey &&key, OtherMapped &&mapped_value) -> std::pair< iterator, bool >
 Insert a new element in the map if there is not already one with an equivalent key, otherwise assigns the new value to the existing one.
 
ARENE_NODISCARD auto key_comp () const noexcept(std::is_nothrow_copy_constructible< Compare >::value) -> Compare
 Obtain a copy of the comparator.
 
auto lower_bound (Key const &key) const noexcept(comparison_is_noexcept<>) -> const_iterator
 Find the first element which is not less than a given key.
 
auto lower_bound (Key const &key) noexcept(comparison_is_noexcept<>) -> iterator
 Find the first element which is not less than a given key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto lower_bound (OtherKey const &key) const noexcept(comparison_is_noexcept< OtherKey >) -> const_iterator
 Find the first element which is not less than a given key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto lower_bound (OtherKey const &key) noexcept(comparison_is_noexcept< OtherKey >) -> iterator
 Find the first element which is not less than a given key.
 
auto operator= (copy_assign_source const &other) noexcept(std::is_nothrow_copy_assignable< Compare >::value &&std::is_nothrow_copy_constructible< Key >::value &&std::is_nothrow_copy_constructible< Value >::value) -> inline_map &
 copy-assignment of a map with the same capacity.
 
auto operator= (dummy_copy_assign_source const &) -> inline_map &=delete
 Deleted copy-assignment if the map should not be copy-assignable.
 
auto operator= (dummy_move_assign_source &&) -> inline_map &=delete
 Deleted move-assignment if the map should not be move-assignable.
 
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity > Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value >>
auto operator= (inline_map< Key, Value, OtherCapacity, Compare > &&other) -> inline_map &
 Move-assignment of a map with a greater capacity.
 
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity< Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value > > = nullptr>
auto operator= (inline_map< Key, Value, OtherCapacity, Compare > &&other) -> inline_map &
 Move-assignment of a map with a lesser capacity.
 
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity > Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value >>
auto operator= (inline_map< Key, Value, OtherCapacity, Compare > const &other) -> inline_map &
 copy-assignment of a map with a greater capacity.
 
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity< Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value > > = nullptr>
auto operator= (inline_map< Key, Value, OtherCapacity, Compare > const &other) -> inline_map &
 copy-assignment of a map with a smaller capacity.
 
auto operator= (move_assign_source &&other) noexcept(std::is_nothrow_move_assignable< Compare >::value &&std::is_nothrow_move_constructible< value_type >::value) -> inline_map &
 Move-assignment of a map with the same capacity.
 
auto operator[] (Key const &key) -> Value &
 Obtain a reference to the mapped value for the specified key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_insertion_supported< OtherKey > >, std::enable_if_t< std::is_constructible< Key, OtherKey const & >::value > > = nullptr>
auto operator[] (OtherKey const &key) -> Value &
 Obtain a reference to the mapped value for the specified key.
 
ARENE_NODISCARD auto rbegin () const noexcept -> const_reverse_iterator
 Obtain an iterator referring to the beginning of a reversed traversal of the sorted range of elements.
 
ARENE_NODISCARD auto rbegin () noexcept -> reverse_iterator
 Obtain an iterator referring to the beginning of a reversed traversal of the sorted range of elements.
 
ARENE_NODISCARD auto rend () const noexcept -> const_reverse_iterator
 Obtain an iterator referring to one past the last element in a reversed traversal of the sorted range of elements.
 
ARENE_NODISCARD auto rend () noexcept -> reverse_iterator
 Obtain an iterator referring to one past the last element in a reversed traversal of the sorted range of elements.
 
ARENE_NODISCARD auto size () const noexcept -> size_type
 Get the number of elements in the map.
 
template<typename... Args, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_move_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, Args &&... >::value > > = nullptr>
auto try_emplace (Key &&key, Args &&... args) -> std::pair< iterator, bool >
 Try to emplace a new element in the map if there is not already one with the corresponding key.
 
template<typename... Args, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, Args &&... >::value > > = nullptr>
auto try_emplace (Key const &key, Args &&... args) -> std::pair< iterator, bool >
 Try to emplace a new element in the map if there is not already one with the corresponding key.
 
template<typename OtherKey, typename... Args, constraints< std::enable_if_t< transparent_insertion_supported< OtherKey > >, std::enable_if_t<!decays_to_v< OtherKey, Key > >, std::enable_if_t< std::is_constructible< Key, OtherKey && >::value >, std::enable_if_t< std::is_constructible< Value, Args &&... >::value > > = nullptr>
auto try_emplace (OtherKey &&key, Args &&... args) -> std::pair< iterator, bool >
 Try to emplace a new element in the map if there is not already one with an equivalent key.
 
auto upper_bound (Key const &key) const noexcept(comparison_is_noexcept<>) -> const_iterator
 Find the first element which is greater than a given key.
 
auto upper_bound (Key const &key) noexcept(comparison_is_noexcept<>) -> iterator
 Find the first element which is greater than a given key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto upper_bound (OtherKey const &key) const noexcept(comparison_is_noexcept< OtherKey >) -> const_iterator
 Find the first element which is greater than a given key.
 
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto upper_bound (OtherKey const &key) noexcept(comparison_is_noexcept< OtherKey >) -> iterator
 Find the first element which is greater than a given key.
 

Static Public Member Functions

template<size_type OtherCapacity>
static ARENE_NODISCARD auto fast_inequality_check (inline_map const &lhs, inline_map< Key, Value, OtherCapacity, Compare > const &rhs) noexcept -> inequality_heuristic
 Fast inequality heuristic to shortcut on different sized containers.
 
template<size_type OtherCapacity, typename SfinaeKey = key_type, typename SfinaeMappedType = mapped_type, constraints< std::enable_if_t< compare_three_way_supported_v< SfinaeKey > >, std::enable_if_t< compare_three_way_supported_v< SfinaeMappedType > > > = nullptr>
static ARENE_NODISCARD auto three_way_compare (inline_map const &lhs, inline_map< Key, Value, OtherCapacity, Compare > const &rhs) noexcept -> strong_ordering
 Compares two maps lexicographically .
 
template<typename C = Compare, constraints< std::enable_if_t< std::is_default_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct () noexcept(std::is_nothrow_default_constructible< Compare >::value) -> optional< inline_map >
 Construct an empty map with a default-constructed comparator.
 
template<typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct (Compare const &comparator) noexcept(std::is_nothrow_copy_constructible< Compare >::value) -> optional< inline_map >
 Construct a map with a comparator copied from the supplied value.
 
template<typename K = Key, typename V = Value, typename C = Compare, constraints< std::enable_if_t< std::is_move_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< K >::value >, std::enable_if_t< std::is_move_constructible< V >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct (inline_map &&other) noexcept(std::is_nothrow_move_constructible< C >::value &&std::is_nothrow_copy_constructible< K >::value &&std::is_nothrow_move_constructible< V >::value) -> optional< inline_map >
 Move construct a map.
 
template<typename V = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< V >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct (inline_map const &other) noexcept(std::is_nothrow_copy_constructible< C >::value &&std::is_nothrow_copy_constructible< V >::value) -> optional< inline_map >
 Copy construct a map.
 
template<std::size_t OtherCapacity, typename K = Key, typename V = Value, typename C = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< K >::value >, std::enable_if_t< std::is_move_constructible< V >::value >, std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct (inline_map< Key, Value, OtherCapacity, Compare > &&other) noexcept(std::is_nothrow_copy_constructible< C >::value &&std::is_nothrow_copy_constructible< K >::value &&std::is_nothrow_move_constructible< V >::value) -> optional< inline_map >
 Move construct a map with a different size.
 
template<std::size_t OtherCapacity, typename V = value_type, typename C = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< V >::value >, std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct (inline_map< Key, Value, OtherCapacity, Compare > const &other) noexcept(std::is_nothrow_copy_constructible< C >::value &&std::is_nothrow_copy_constructible< V >::value) -> optional< inline_map >
 Copy construct a map with a different size.
 
template<typename T = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_default_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< T >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct (std::initializer_list< value_type > init_list) noexcept(std::is_nothrow_default_constructible< Compare >::value &&comparison_is_noexcept<> &&std::is_nothrow_copy_constructible< Key >::value &&std::is_nothrow_copy_constructible< Value >::value) -> optional< inline_map >
 Construct a map with a default-constructed comparator and copies of the elements from the provided initializer list. If there are too many elements, return an empty optional.
 
template<typename T = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< T >::value > > = nullptr>
static ARENE_NODISCARD auto try_construct (std::initializer_list< value_type > init_list, Compare const &comparator) noexcept(std::is_nothrow_copy_constructible< Compare >::value &&comparison_is_noexcept<> &&std::is_nothrow_copy_constructible< Key >::value &&std::is_nothrow_copy_constructible< Value >::value) -> optional< inline_map >
 Construct a map with a comparator copied from the supplied value and copies of the elements from the provided initializer list. If there are too many elements, return an empty optional.
 

Static Public Attributes

static constexpr std::integral_constant< size_type, Capacity > capacity {}
 map capacity
 
static constexpr std::integral_constant< size_type, Capacity > max_size {}
 Get the maximum number of elements in the map, Capacity.
 

Friends

template<typename OtherKey, typename OtherValue, std::size_t OtherCapacity, typename OtherCompare>
class inline_map
 
template<size_type OtherCapacity, typename SfinaeValue = value_type, constraints< std::enable_if_t< is_equality_comparable_v< SfinaeValue > > > = nullptr>
ARENE_NODISCARD friend auto operator!= (inline_map const &lhs, inline_map< Key, Value, OtherCapacity, Compare > const &rhs) noexcept -> bool
 Compares two maps for inequality of elements when mapped_value is not three-way-comparable.
 
template<size_type OtherCapacity, typename SfinaeValue = value_type, constraints< std::enable_if_t< is_equality_comparable_v< SfinaeValue > > > = nullptr>
ARENE_NODISCARD friend auto operator== (inline_map const &lhs, inline_map< Key, Value, OtherCapacity, Compare > const &rhs) noexcept -> bool
 Compares two maps for equality of elements when mapped_value is not three-way-comparable.
 
template<typename Self, constraints< std::enable_if_t< decays_to_v< Self, inline_map > > > = nullptr>
auto value_at_index (inline_map_passkey, Self &self, std::uint16_t index) -> conditional_t< std::is_const< std::remove_reference_t< Self > >::value, value_type const &, value_type & >
 Gets the value at an index.
 

Detailed Description

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
class arene::base::inline_map< Key, Value, Capacity, Compare >

A container similar to std::map that has a fixed capacity.

The storage is held internally in the object. Any attempt to store more than Capacity elements will either result in a precondition failure (and thus process termination), or an error being returned. The comparison function specified with the Compare template parameter can either return bool, in which case it is assumed to be a simple ordering comparison like std::less, or it can return strong_ordering, in which case it is assumed to be a three-way comparison operator. The default comparison is three_way_compare.

Template Parameters
KeyThe key type for the map
ValueThe mapped type for the map
CapacityThe maximum number of elements that can be stored in the map
CompareThe comparison function
Precondition
The comparison must provide a strict ordering over the values of Key

Member Typedef Documentation

◆ const_iterator

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::const_iterator = iterator_impl<true>

The type of an iterator that provides const access to the elements.

◆ const_pointer

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::const_pointer = value_type const*

The type of a const pointer to the value type of the map.

◆ const_reference

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::const_reference = value_type const&

The type of a const reference to the value type of the map.

◆ const_reverse_iterator

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::const_reverse_iterator = ::arene::base::reverse_iterator<const_iterator>

The type of an iterator that provides const access to the elements and iterates in reverse through the elements.

◆ difference_type

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::difference_type = typename iterator::difference_type

The difference type of the map.

◆ inline_map_base_type

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map_base_type = map_base_type

inline_map_base type

◆ iterator

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::iterator = iterator_impl<false>

The type of an iterator that provides non- const access to the elements.

◆ key_compare

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::key_compare = typename map_base_type::compare_type

The comparator of the map.

◆ key_type

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::key_type = typename map_base_type::key_type

The key type of the map.

◆ mapped_type

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::mapped_type = typename map_base_type::mapped_type

The mapped type of the map.

◆ pointer

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::pointer = value_type*

The type of a pointer to the value type of the map.

◆ reference

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::reference = value_type&

The type of a reference to the value type of the map.

◆ reverse_iterator

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::reverse_iterator = ::arene::base::reverse_iterator<iterator>

The type of an iterator that provides non- const access to the elements and iterates in reverse through the elements.

◆ size_type

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::size_type = typename map_base_type::size_type

The size type of the map.

◆ value_type

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
using arene::base::inline_map< Key, Value, Capacity, Compare >::value_type = typename map_base_type::value_type

The value type of the map.

Constructor & Destructor Documentation

◆ inline_map() [1/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( )
default

Construct the map with a default-constructed comparator and no elements.

Exceptions
Anyexception thrown by the default constructor of the comparator

◆ ~inline_map()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
arene::base::inline_map< Key, Value, Capacity, Compare >::~inline_map ( )
default

Default destructor.

◆ inline_map() [2/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename T = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_default_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< T >::value > > = nullptr>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( std::initializer_list< value_type > init_list)
inline

Construct the map with a default-constructed comparator and copies of the elements from the provided initializer list.

Template Parameters
TThe value type of the map, used so this constructor is not viable if value_type cannot be copy constructed.
CThe comparator type of the map, used so this constructor is not viable if Compare cannot be default constructed.
Parameters
init_listThe initializer list
Exceptions
Anyexception thrown by the default constructor of the comparator, the copy constructor of the keys or values, or the comparisons
Precondition
There are no more than Capacity elements in init_list with unique keys, else ARENE_PRECONDITION violation.

◆ inline_map() [3/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename T = Value, typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< T >::value >, std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( std::initializer_list< value_type > init_list,
Compare const & compare )
inline

Construct the map with a copy of the specified comparator and copies of the elements from the provided initializer list.

Template Parameters
TThe value type of the map, used so this constructor is not viable if value_type cannot be copy constructed.
CThe comparator type of the map, used so this constructor is not viable if Compare cannot be copy constructed.
Parameters
init_listThe initializer list
compareThe comparator to copy
Exceptions
Anyexception thrown by the copy-constructor of the comparator, the copy constructor of the keys or values, or the comparisons
Precondition
There are no more than Capacity elements in init_list with unique keys, else ARENE_PRECONDITION violation.

◆ inline_map() [4/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( Compare const & compare)
inlineexplicitnoexcept

Construct the map with a copy of the specified comparator and no elements.

Parameters
compareThe comparator to copy#
Exceptions
Anyexception thrown by the copy-constructor of the comparator

◆ inline_map() [5/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( inline_map< Key, Value, Capacity, Compare > const & other)
default

Copy the source map, so the new map has the same size, comparator and elements as the source.

Parameters
otherThe instance to be copied.
Exceptions
Anyexception thrown by the copy constructor of the comparator, the keys, or values

◆ inline_map() [6/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( move_construct_source && other)
inlinenoexcept

Move the source map into the new instance, so the new map has the same size, comparator and elements as the source did before-hand.

All the keys from the source map are copy-constructed, and all the mapped values are move-constructed.

Parameters
otherThe instance to be copied.
Exceptions
Anyexception thrown by the copy constructor of the comparator or the keys, or the move-constructor of the values

◆ inline_map() [7/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeCompare >::value > > = nullptr>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( inline_map< Key, Value, OtherCapacity, Compare > const & other)
inline

Copy from a map with a different capacity.

Template Parameters
OtherCapacityThe capacity of the other map
SfinaeKeyDummy key type for SFINAE
SfinaeValueDummy value type for SFINAE
SfinaeCompareDummy compare type for SFINAE
Parameters
otherThe source map
Exceptions
Anyexception thrown by the copy constructors of the comparator, keys or values
Precondition
other.size()<=Capacity, else ARENE_PRECONDITION violation.

◆ inline_map() [8/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeCompare >::value > > = nullptr>
arene::base::inline_map< Key, Value, Capacity, Compare >::inline_map ( inline_map< Key, Value, OtherCapacity, Compare > && other)
inline

Move from a map with a different capacity.

Template Parameters
OtherCapacityThe capacity of the other map
SfinaeKeyDummy key type for SFINAE
SfinaeValueDummy value type for SFINAE
SfinaeCompareDummy compare type for SFINAE
Parameters
otherThe source map
Exceptions
Anyexception thrown by the copy constructors of the comparator or keys or the move constructor of the values
Precondition
other.size()<=Capacity, else ARENE_PRECONDITION violation.

Member Function Documentation

◆ at() [1/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::at ( Key const & key) -> Value&
inline

Obtain a reference to the mapped value for the specified key or throw.

Parameters
keyThe key to obtain the value for
Returns
Value& A reference to the mapped value
Exceptions
std::out_of_rangeif find(key)==end() .
Anyexception thrown by the comparisons

◆ at() [2/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::at ( Key const & key) const -> Value const&
inline

Obtain a reference to the mapped value for the specified key or throw.

Parameters
keyThe key to obtain the value for
Returns
Value const& A reference to the mapped value
Exceptions
std::out_of_rangeif find(key)==end() .
Anyexception thrown by the comparisons

◆ at() [3/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled >, std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::at ( OtherKey const & key) -> Value&
inline

Obtain a reference to the mapped value for the specified key or throw.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to obtain the value for
Returns
Value& A reference to the mapped value
Exceptions
std::out_of_rangeif find(key)==end() .
Anyexception thrown by the comparisons

◆ at() [4/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled >, std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::at ( OtherKey const & key) const -> Value const&
inline

Obtain a reference to the mapped value for the specified key or throw.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to obtain the value for
Returns
Value& A reference to the mapped value
Exceptions
std::out_of_rangeif find(key)==end() .
Anyexception thrown by the comparisons

◆ begin() [1/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::begin ( ) const -> const_iterator
inlinenoexcept

Obtain an iterator referring to the beginning of the sorted range of elements.

Returns
const_iterator Points to the first element in the sequence, or end() if empty() .

◆ begin() [2/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::begin ( ) -> iterator
inlinenoexcept

Obtain an iterator referring to the beginning of the sorted range of elements.

Returns
iterator Points to the first element in the sequence, or end() if empty() .

◆ cbegin()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::cbegin ( ) const -> const_iterator
inlinenoexcept

Obtain an iterator referring to the beginning of the sorted range of elements.

Returns
const_iterator Points to the first element in the sequence, or end() if empty() .

◆ cend()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::cend ( ) const -> const_iterator
inlinenoexcept

Obtain an iterator referring to one past the last element in the sorted range of elements.

Returns
const_iterator Points to one past the last element in the sequence.

◆ clear()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
void arene::base::inline_map< Key, Value, Capacity, Compare >::clear ( )
inlinenoexcept

Destroy all elements in *this and set the size to zero.

Postcondition
size()==0 .
The destructors of all elements in the range [begin(),end()) will have been called once.

◆ contains() [1/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::contains ( Key const & key) const -> bool
inlinenoexcept

Check if the set contains a specific key.

Parameters
keyThe key to search for
Returns
true if find(key)!=end() .
false if find(key)==end() .

◆ contains() [2/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::contains ( OtherKey const & key) const -> bool
inlinenoexcept

Check if the set contains a key equivalent to a specific value.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to search for
Returns
true if find(key)!=end() .
false if find(key)==end() .

◆ count() [1/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::count ( Key const & key) const -> size_type
inlinenoexcept

Return the number of elements in the map equivalent to a specific key.

Parameters
keyThe key to search for.
Returns
std::size_t 0 if the element was not in the map, else 1 .

◆ count() [2/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::count ( OtherKey const & key) const -> size_type
inlinenoexcept

Return the number of elements in the map equivalent to a specific key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to search for.
Returns
std::size_t 0 if the element was not in the map, else 1 .

◆ crbegin()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::crbegin ( ) const -> const_reverse_iterator
inlinenoexcept

Obtain an iterator referring to the beginning of a reversed traversal of the sorted range of elements.

Returns
const_reverse_iterator Points to the last element in the sequence, or rend() if empty() .

◆ crend()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::crend ( ) const -> const_reverse_iterator
inlinenoexcept

Obtain an iterator referring to one past the last element in a reversed traversal of the sorted range of elements.

Returns
const_reverse_iterator An iterator pointing to one before the first element in the sequence.

◆ emplace()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename... Args, constraints< std::enable_if_t< std::is_constructible< value_type, Args &&... >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::emplace ( Args &&... args) -> std::pair<iterator, bool>
inline

Construct a new value_type object and try to insert it in the map if there is not already one with the corresponding key.

Perfectly forwards the provided arguments into the constructor of the new element if an appropriate element does not already exist.

Template Parameters
ArgsThe types of the initializers for the value type
Parameters
argsThe values with which to construct the value value
Returns
A pair of an iterator to the element with a key equivalent to key, and a boolean with a value of true if the element was inserted, or false otherwise.
Exceptions
Anyexception thrown by the comparisons, the constructor of value_type
Precondition
size()<Capacity or there is already a corresponding element in the map, else ARENE_PRECONDITION violation.

◆ empty()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::empty ( ) const -> bool
inlinenoexcept

Check if the map is empty.

Returns
true if the map is empty, false otherwise

◆ end() [1/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::end ( ) const -> const_iterator
inlinenoexcept

Obtain an iterator referring to one past the last element in the sorted range of elements.

Returns
const_iterator Points to one past the last element in the sequence.

◆ end() [2/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::end ( ) -> iterator
inlinenoexcept

Obtain an iterator referring to one past the last element in the sorted range of elements.

Returns
iterator An iterator pointing to one past the last element in the sequence.

◆ equal_range() [1/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::equal_range ( Key const & key) const -> std::pair<const_iterator, const_iterator>
inlinenoexcept

Finds the sequence of elements whose keys compare equivalent to a given key.

Parameters
keyThe key to search for
Returns
std::pair<iterator, iterator> A pair of iterators such that all elements in the range [first,second) have keys which compare equal to key if there was a key equivalent to key in the map. Otherwise both iterators will be end() .

◆ equal_range() [2/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::equal_range ( Key const & key) -> std::pair<iterator, iterator>
inlinenoexcept

Finds the sequence of elements whose keys compare equivalent to a given key.

Parameters
keyThe key to search for
Returns
std::pair<iterator, iterator> A pair of iterators such that all elements in the range [first,second) have keys which compare equal to key if there was a key equivalent to key in the map. Otherwise both iterators will be end() .

◆ equal_range() [3/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::equal_range ( OtherKey const & key) const -> std::pair<const_iterator, const_iterator>
inlinenoexcept

Finds the sequence of elements whose keys compare equivalent to a given key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to search for
Returns
std::pair<const_iterator, const_iterator> A pair of iterators such that all elements in the range [first,second) have keys which compare equal to key if there was a key equivalent to key in the map. Otherwise both iterators will be end() .

◆ equal_range() [4/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::equal_range ( OtherKey const & key) -> std::pair<iterator, iterator>
inlinenoexcept

Finds the sequence of elements whose keys compare equivalent to a given key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to search for
Returns
std::pair<iterator, iterator> A pair of iterators such that all elements in the range [first,second) have keys which compare equal to key if there was a key equivalent to key in the map. Otherwise both iterators will be end() .

◆ erase() [1/5]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::erase ( const_iterator first,
const_iterator last ) -> iterator
inlinenoexcept

Erase all the elements in the specified iterator range.

Parameters
firstAn iterator referring to the start of the range to erase
lastAn iterator referring to the end of the range to erase
Returns
An iterator referring to the element after the erased elements, or end() if there is no such element.
Precondition
[first,last) must be a valid iterator range referring to *this, else ARENE_PRECONDITION violation.

◆ erase() [2/5]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::erase ( const_iterator pos) -> iterator
inlinenoexcept

Erase the element at the specified position.

Parameters
posAn iterator referring to the element to erase
Returns
An iterator referring to the element after the erased element, or end() if there is no such element.
Precondition
pos must be a valid dereferencable iterator referring to an element in *this, else ARENE_PRECONDITION violation.

◆ erase() [3/5]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::erase ( iterator pos) -> iterator
inlinenoexcept

Erase the element at the specified position.

Parameters
posAn iterator referring to the element to erase
Returns
An iterator referring to the element after the erased element, or end() if there is no such element.
Precondition
pos must be a valid dereferencable iterator referring to an element in *this, else ARENE_PRECONDITION violation.

◆ erase() [4/5]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::erase ( Key const & key) -> iterator
inlinenoexcept

Erase the element with the corresponding key, if there is one.

Parameters
keyThe key to erase.
Returns
iterator An iterator which points to the position after the removed element.

◆ erase() [5/5]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::erase ( OtherKey const & key) -> iterator
inlinenoexcept

Erase the element with the corresponding key, if there is one.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to erase.
Returns
iterator An iterator which points to the position after the removed element.

◆ fast_inequality_check()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<size_type OtherCapacity>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::fast_inequality_check ( inline_map< Key, Value, Capacity, Compare > const & lhs,
inline_map< Key, Value, OtherCapacity, Compare > const & rhs ) -> inequality_heuristic
inlinestaticnoexcept

Fast inequality heuristic to shortcut on different sized containers.

Template Parameters
OtherCapacitythe capacity of rhs
Parameters
lhsThe left-hand operand to the check
rhsThe right-hand operand to the check
Returns
inequality_heuristic::may_be_equal_or_not_equal if lhs.size()==rhs.size()
inequality_heuristic::definitely_not_equal if lhs.size()!=rhs.size()

◆ find() [1/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::find ( Key const & key) const -> const_iterator
inlinenoexcept

Obtain an iterator referring to the element equivalent to the supplied key, if there is one.

Parameters
keyThe key to find
Returns
const_iterator to the equivalent element, or end() if the element is not found

◆ find() [2/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::find ( Key const & key) -> iterator
inlinenoexcept

Obtain an iterator referring to the element equivalent to the supplied key, if there is one.

Parameters
keyThe key to find
Returns
iterator to the equivalent element, or end() if the element is not found

◆ find() [3/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::find ( OtherKey const & key) const -> const_iterator
inlinenoexcept

Obtain an iterator referring to the element equivalent to the supplied key, if there is one.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to find
Returns
const_iterator to the equivalent element, or end() if the element is not found

◆ find() [4/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::find ( OtherKey const & key) -> iterator
inlinenoexcept

Obtain an iterator referring to the element equivalent to the supplied key, if there is one.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to find
Returns
iterator to the equivalent element, or end() if the element is not found

◆ insert() [1/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename P, constraints< std::enable_if_t<!std::is_same< value_type, P >::value >, std::enable_if_t< std::is_constructible< value_type, P && >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::insert ( P && value) -> std::pair<iterator, bool>
inline

Insert a new element in the map if there is not already one with the corresponding key.

If an element does not already exist with the given key, the key is copy-constructed into the map while the value is move-constructed.

Template Parameters
PThe type of the provided initializer
Parameters
valueThe value to insert
Returns
std::pair<iterator, bool> whose first element is the key equivalent to v.first, and whose second element is a boolean with a value of true if the element was inserted, or false otherwise.
Precondition
contains(value.first) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons, or the copy constructor of value_type

◆ insert() [2/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename SfinaeKey = Key, typename SfinaeValue = Value, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::insert ( value_type && value) -> std::pair<iterator, bool>
inline

Insert a new element in the map if there is not already one with the corresponding key.

If an element does not already exist with the given key, the key is copy-constructed into the map while the value is move-constructed.

Template Parameters
SfinaeKeyDummy key type for SFINAE.
SfinaeValueDummy value type for SFINAE.
Parameters
valueThe value to insert
Returns
std::pair<iterator, bool> whose first element is the key equivalent to v.first, and whose second element is a boolean with a value of true if the element was inserted, or false otherwise.
Precondition
contains(value.first) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons, or the copy constructor of value_type

◆ insert() [3/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename SfinaeKey = Key, typename SfinaeValue = Value, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::insert ( value_type const & value) -> std::pair<iterator, bool>
inline

Insert a new element in the map if there is not already one with the corresponding key.

Copy constructs the provided value into the new element if an appropriate element does not already exist.

Template Parameters
SfinaeKeyDummy key type for SFINAE.
SfinaeValueDummy value type for SFINAE.
Parameters
valueThe value to insert
Returns
std::pair<iterator, bool> whose first element is the key equivalent to v.first, and whose second element is a boolean with a value of true if the element was inserted, or false otherwise.
Precondition
contains(value.first) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons, or the copy constructor of value_type

◆ insert_or_assign() [1/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherMapped, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_move_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, OtherMapped && >::value >, std::enable_if_t< std::is_assignable< Value &, OtherMapped && >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::insert_or_assign ( Key && key,
OtherMapped && mapped_value ) -> std::pair<iterator, bool>
inline

Insert a new element in the map if there is not already one with the corresponding key, otherwise assigns the new value to the existing one.

Perfectly forwards the provided key and value into the constructor of the new element if an appropriate element does not already exist; perfectly forwards into the assignment operator for the existing element if there is one.

Template Parameters
OtherMappedThe type of the initializer for the mapped type
SfinaeKeyThe key type, used to delete this overload if the key is not move constructible
Parameters
keyThe key for which to insert or assign an element
mapped_valueThe value with which to construct or assign the mapped value
Returns
A pair of an iterator to the element with a key equivalent to key, and a boolean with a value of true if the element was inserted, or false otherwise.
Precondition
contains(key) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons, the move constructor of Key or the constructor or assignment operator of Value .

◆ insert_or_assign() [2/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherMapped, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, OtherMapped && >::value >, std::enable_if_t< std::is_assignable< Value &, OtherMapped && >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::insert_or_assign ( Key const & key,
OtherMapped && mapped_value ) -> std::pair<iterator, bool>
inline

Insert a new element in the map if there is not already one with the corresponding key, otherwise assigns the new value to the existing one.

Perfectly forwards the provided key and value into the constructor of the new element if an appropriate element does not already exist; perfectly forwards into the assignment operator for the existing element if there is one.

Template Parameters
OtherMappedThe type of the initializer for the mapped type
SfinaeKeyThe key type, used to delete this overload if the key is not copy constructible
Parameters
keyThe key for which to insert or assign an element
mapped_valueThe value with which to construct or assign the mapped value
Returns
A pair of an iterator to the element with a key equivalent to key, and a boolean with a value of true if the element was inserted, or false otherwise.
Precondition
contains(key) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons, the move constructor of Key or the constructor or assignment operator of Value .

◆ insert_or_assign() [3/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, typename OtherMapped, constraints< std::enable_if_t< transparent_insertion_supported< OtherKey > >, std::enable_if_t< std::is_constructible< Key, OtherKey && >::value >, std::enable_if_t< std::is_constructible< Value, OtherMapped && >::value >, std::enable_if_t< std::is_assignable< Value &, OtherMapped && >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::insert_or_assign ( OtherKey && key,
OtherMapped && mapped_value ) -> std::pair<iterator, bool>
inline

Insert a new element in the map if there is not already one with an equivalent key, otherwise assigns the new value to the existing one.

Perfectly forwards the provided key and value into the constructor of the new element if an appropriate element does not already exist; perfectly forwards into the assignment operator for the existing element if there is one.

Template Parameters
OtherKeyThe key type. Must satisfy decays_to_v<K, Key> || transparent_comparison_supported<K> and std::is_constructible<Key, K&&>
OtherMappedThe type of the initializer for the mapped type
Parameters
keyThe key for which to insert or assign an element
mapped_valueThe value with which to construct or assign the mapped value
Returns
A pair of an iterator to the element with a key equivalent to key, and a boolean with a value of true if the element was inserted, or false otherwise.
Precondition
contains(key) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons, the move constructor of Key or the constructor or assignment operator of Value .

◆ key_comp()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::key_comp ( ) const -> Compare
inlinenoexcept

Obtain a copy of the comparator.

Returns
The comparator
Exceptions
Anyexception thrown by the copy-constructor of the comparator

◆ lower_bound() [1/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::lower_bound ( Key const & key) const -> const_iterator
inlinenoexcept

Find the first element which is not less than a given key.

Parameters
keyThe key to find the lower bound for.
Returns
const_iterator to the first element which is not less than key , or end() if there is no such element.

◆ lower_bound() [2/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::lower_bound ( Key const & key) -> iterator
inlinenoexcept

Find the first element which is not less than a given key.

Parameters
keyThe key to find the lower bound for.
Returns
iterator to the first element which is not less than key , or end() if there is no such element.

◆ lower_bound() [3/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::lower_bound ( OtherKey const & key) const -> const_iterator
inlinenoexcept

Find the first element which is not less than a given key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to find the lower bound for.
Returns
const_iterator to the first element which is not less than key , or end() if there is no such element.

◆ lower_bound() [4/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::lower_bound ( OtherKey const & key) -> iterator
inlinenoexcept

Find the first element which is not less than a given key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to find the lower bound for.
Returns
iterator to the first element which is not less than key , or end() if there is no such element.

◆ operator=() [1/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( copy_assign_source const & other) -> inline_map&
inlinenoexcept

copy-assignment of a map with the same capacity.

If an exception is thrown then *this is left in a valid state containing the subset of elements copied from the source prior to the exception being thrown.

Parameters
otherThe instance to be copied.
Returns
inline_map& A reference to *this
Exceptions
Anyexception thrown by the copy assignment of the comparator, or the copy constructors of the keys, or values

◆ operator=() [2/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( dummy_copy_assign_source const & ) -> inline_map &=delete
delete

Deleted copy-assignment if the map should not be copy-assignable.

◆ operator=() [3/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( dummy_move_assign_source && ) -> inline_map &=delete
delete

Deleted move-assignment if the map should not be move-assignable.

◆ operator=() [4/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity > Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value >>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( inline_map< Key, Value, OtherCapacity, Compare > && other) -> inline_map&
inline

Move-assignment of a map with a greater capacity.

All the keys from the source map are copy-constructed, and all the mapped values are move-constructed. The source map is cleared, so all elements are destroyed and this size is zero. If an exception is thrown then *this is left in a valid state containing the subset of elements moved from the source prior to the exception being thrown, and the source is left empty.

Template Parameters
OtherCapacityThe capacity of the other map
SfinaeKeyDummy key type for SFINAE
SfinaeValueDummy value type for SFINAE
SfinaeCompareDummy comparator type for SFINAE
Parameters
otherThe instance to be moved.
Returns
inline_map& A reference to *this
Precondition
other.size()<=Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the move-assignment of the comparator or the copy-constructor of the keys, or the move-constructor of the values

◆ operator=() [5/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity< Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_move_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( inline_map< Key, Value, OtherCapacity, Compare > && other) -> inline_map&
inline

Move-assignment of a map with a lesser capacity.

All the keys from the source map are copy-constructed, and all the mapped values are move-constructed. The source map is cleared, so all elements are destroyed and this size is zero. If an exception is thrown then *this is left in a valid state containing the subset of elements moved from the source prior to the exception being thrown, and the source is left empty.

Template Parameters
OtherCapacityThe capacity of the other map
SfinaeKeyDummy key type for SFINAE
SfinaeValueDummy value type for SFINAE
SfinaeCompareDummy comparator type for SFINAE
Parameters
otherThe instance to be moved.
Returns
inline_map& A reference to *this
Exceptions
Anyexception thrown by the move-assignment of the comparator or the copy-constructor of the keys, or the move-constructor of the values

◆ operator=() [6/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity > Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value >>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( inline_map< Key, Value, OtherCapacity, Compare > const & other) -> inline_map&
inline

copy-assignment of a map with a greater capacity.

If an exception is thrown then *this is left in a valid state containing the subset of elements copied from the source prior to the exception being thrown.

Template Parameters
OtherCapacityThe capacity of the other map
SfinaeCompareDummy key type for SFINAE
SfinaeValueDummy value type for SFINAE
SfinaeCompareDummy compare type for SFINAE
Parameters
otherThe instance to be copied.
Returns
inline_map& A reference to *this
Exceptions
Anyexception thrown by the copy assignment of the comparator, or the copy constructors of the keys, or values.
Precondition
other.size()<=Capacity, else ARENE_PRECONDITION violation.

◆ operator=() [7/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename SfinaeKey = Key, typename SfinaeValue = Value, typename SfinaeCompare = Compare, constraints< std::enable_if_t<(OtherCapacity< Capacity)>, std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_copy_constructible< SfinaeValue >::value >, std::enable_if_t< std::is_move_assignable< SfinaeCompare >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( inline_map< Key, Value, OtherCapacity, Compare > const & other) -> inline_map&
inline

copy-assignment of a map with a smaller capacity.

If an exception is thrown then *this is left in a valid state containing the subset of elements copied from the source prior to the exception being thrown.

Template Parameters
OtherCapacityThe capacity of the other map
SfinaeKeyDummy key type for SFINAE
SfinaeValueDummy value type for SFINAE
SfinaeCompareDummy comparator type for SFINAE
Parameters
otherThe instance to be copied.
Returns
inline_map& A reference to *this
Exceptions
Anyexception thrown by the copy assignment of the comparator, or the copy constructors of the keys, or values

◆ operator=() [8/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator= ( move_assign_source && other) -> inline_map&
inlinenoexcept

Move-assignment of a map with the same capacity.

All the keys from the source map are copy-constructed, and all the mapped values are move-constructed. The source map is cleared, so all elements are destroyed and this size is zero. If an exception is thrown then *this is left in a valid state containing the subset of elements moved from the source prior to the exception being thrown, and the source is left empty.

Parameters
otherThe instance to be moved.
Returns
inline_map& A reference to *this
Exceptions
Anyexception thrown by the move-assignment of the comparator or the copy-constructor of the keys, or the move-constructor of the values

◆ operator[]() [1/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator[] ( Key const & key) -> Value&
inline

Obtain a reference to the mapped value for the specified key.

Parameters
keyThe key to obtain the value for
Returns
A reference to the mapped value. If key did not exist in the map, then a default constructed Value is inserted into the map at key and a reference to it is returned.
Exceptions
Anyexception thrown by the comparisons, and exception throw by the copy-constructor of Key, or the default-constructor of Value
Precondition
size()<Capacity if key is not in *this

◆ operator[]() [2/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_insertion_supported< OtherKey > >, std::enable_if_t< std::is_constructible< Key, OtherKey const & >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::operator[] ( OtherKey const & key) -> Value&
inline

Obtain a reference to the mapped value for the specified key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> , and std::is_constructible<Key,const K&> .
Parameters
keyThe key to obtain the value for
Returns
A reference to the mapped value. If key did not exist in the map, then a default constructed Value is inserted into the map at key and a reference to it is returned.
Exceptions
Anyexception thrown by the comparisons, and exception throw by the copy-constructor of Key, or the default-constructor of Value, or
Precondition
size()<Capacity if key is not in *this

◆ rbegin() [1/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::rbegin ( ) const -> const_reverse_iterator
inlinenoexcept

Obtain an iterator referring to the beginning of a reversed traversal of the sorted range of elements.

Returns
const_reverse_iterator Points to the last element in the sequence, or rend() if empty() .

◆ rbegin() [2/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::rbegin ( ) -> reverse_iterator
inlinenoexcept

Obtain an iterator referring to the beginning of a reversed traversal of the sorted range of elements.

Returns
reverse_iterator Points to the last element in the sequence, or rend() if empty() .

◆ rend() [1/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::rend ( ) const -> const_reverse_iterator
inlinenoexcept

Obtain an iterator referring to one past the last element in a reversed traversal of the sorted range of elements.

Returns
const_reverse_iterator An iterator pointing to one before the first element in the sequence.

◆ rend() [2/2]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::rend ( ) -> reverse_iterator
inlinenoexcept

Obtain an iterator referring to one past the last element in a reversed traversal of the sorted range of elements.

Returns
reverse_iterator An iterator pointing to one before the first element in the sequence.

◆ size()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::size ( ) const -> size_type
inlinenoexcept

Get the number of elements in the map.

Returns
The number of elements

◆ three_way_compare()

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<size_type OtherCapacity, typename SfinaeKey = key_type, typename SfinaeMappedType = mapped_type, constraints< std::enable_if_t< compare_three_way_supported_v< SfinaeKey > >, std::enable_if_t< compare_three_way_supported_v< SfinaeMappedType > > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::three_way_compare ( inline_map< Key, Value, Capacity, Compare > const & lhs,
inline_map< Key, Value, OtherCapacity, Compare > const & rhs ) -> strong_ordering
inlinestaticnoexcept

Compares two maps lexicographically .

Note
Lexicographic comparison between maps ignores the order of keys as defined by Compare . That is, it is a lexicographic comparison between the value_type elements of each container, in iteration order, using the standard compare_three_way facility. This means that for all possible maps which result in element sequences {{1,"a"}, {2, "b"}, {3,"c"}} and {{1,"a"}, {2, "b"}, {5,"d"}}, when compared against each other the result of the comparison will always be the same, strong_ordering::less.
Template Parameters
OtherCapacitythe capacity of rhs
SfinaeKeydummy template parameter to disable the operator if key_Type is not three way comparable.
SfinaeMappedTypedummy template parameter to disable the operator if mapped_type is not three way comparable.
Parameters
lhsThe left hand operand to the comparison.
rhsThe right hand operand to the comparison.
Returns
strong_ordering Equivalent to arene::base::lexicographical_compare_three_way(lhs.begin(),lhs.end(),rhs.begin(),rhs.end())

◆ try_construct() [1/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename C = Compare, constraints< std::enable_if_t< std::is_default_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( ) -> optional<inline_map>
inlinestaticnoexcept

Construct an empty map with a default-constructed comparator.

Template Parameters
CThe comparator type of the map, used for constraints
Exceptions
Anyexception thrown by the default constructor of the comparator,
Returns
optional<inline_map> holding a default-constructed map

◆ try_construct() [2/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( Compare const & comparator) -> optional<inline_map>
inlinestaticnoexcept

Construct a map with a comparator copied from the supplied value.

Template Parameters
CThe comparator type of the map, used so this function is not viable if Compare cannot be copy constructed.
Parameters
comparatorA comparator instance to copy
Exceptions
Anyexception thrown by the copy constructor of the comparator
Returns
optional<inline_map> holding a map constructed from the comparator

◆ try_construct() [3/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename K = Key, typename V = Value, typename C = Compare, constraints< std::enable_if_t< std::is_move_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< K >::value >, std::enable_if_t< std::is_move_constructible< V >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( inline_map< Key, Value, Capacity, Compare > && other) -> optional<inline_map>
inlinestaticnoexcept

Move construct a map.

Template Parameters
KThe key type
VThe value type
CThe comparator type of the map, used for constraints
Parameters
otherThe source container
Exceptions
Anyexception thrown by the move constructor of the comparator, or the values
Returns
optional<inline_map> holding a move-constructed map

◆ try_construct() [4/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename V = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< V >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( inline_map< Key, Value, Capacity, Compare > const & other) -> optional<inline_map>
inlinestaticnoexcept

Copy construct a map.

Template Parameters
VThe value type of the map, used for constraints
CThe comparator type of the map, used for constraints
Parameters
otherThe source container
Exceptions
Anyexception thrown by the copy constructor of the comparator, or the values
Returns
optional<inline_map> holding a copy-constructed map

◆ try_construct() [5/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename K = Key, typename V = Value, typename C = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< K >::value >, std::enable_if_t< std::is_move_constructible< V >::value >, std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( inline_map< Key, Value, OtherCapacity, Compare > && other) -> optional<inline_map>
inlinestaticnoexcept

Move construct a map with a different size.

Template Parameters
OtherCapacityThe capacity of the other map
KThe key type
VThe value type
CThe comparator type
Parameters
otherThe source map
Exceptions
Anyexception thrown by the copy constructor of the comparator, or the move constructor of the keys or values
Returns
optional<inline_map> holding the copied map, or nullopt if there were too many elements

◆ try_construct() [6/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<std::size_t OtherCapacity, typename V = value_type, typename C = Compare, constraints< std::enable_if_t< OtherCapacity !=Capacity >, std::enable_if_t< std::is_copy_constructible< V >::value >, std::enable_if_t< std::is_copy_constructible< C >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( inline_map< Key, Value, OtherCapacity, Compare > const & other) -> optional<inline_map>
inlinestaticnoexcept

Copy construct a map with a different size.

Template Parameters
OtherCapacityThe capacity of the other map
VThe value_type
CThe comparator type
Parameters
otherThe source map
Exceptions
Anyexception thrown by the copy constructors of the comparator, keys or values
Returns
optional<inline_map> holding the copied map, or nullopt if there were too many elements

◆ try_construct() [7/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename T = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_default_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< T >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( std::initializer_list< value_type > init_list) -> optional<inline_map>
inlinestaticnoexcept

Construct a map with a default-constructed comparator and copies of the elements from the provided initializer list. If there are too many elements, return an empty optional.

Template Parameters
TThe value type of the map, used so this function is not viable if value_type cannot be copy constructed.
CThe comparator type of the map, used so this function is not viable if Compare cannot be default constructed.
Parameters
init_listThe initializer list
Exceptions
Anyexception thrown by the default constructor of the comparator, the copy constructor of the keys or values, or the comparisons
Returns
optional<inline_map> holding a map constructed with the elements from the initializer list, or nullopt if there were too many elements.

◆ try_construct() [8/8]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename T = value_type, typename C = Compare, constraints< std::enable_if_t< std::is_copy_constructible< C >::value >, std::enable_if_t< std::is_copy_constructible< T >::value > > = nullptr>
static ARENE_NODISCARD auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_construct ( std::initializer_list< value_type > init_list,
Compare const & comparator ) -> optional<inline_map>
inlinestaticnoexcept

Construct a map with a comparator copied from the supplied value and copies of the elements from the provided initializer list. If there are too many elements, return an empty optional.

Template Parameters
TThe value type of the map, used so this function is not viable if value_type cannot be copy constructed.
CThe comparator type of the map, used so this function is not viable if Compare cannot be default constructed.
Parameters
init_listThe initializer list
comparatorA comparator instance to copy
Exceptions
Anyexception thrown by the copy constructor of the comparator, the copy constructor of the keys or values, or the comparisons
Returns
optional<inline_map> holding a map constructed with the elements from the initializer list, or nullopt if there were too many elements.

◆ try_emplace() [1/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename... Args, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_move_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, Args &&... >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_emplace ( Key && key,
Args &&... args ) -> std::pair<iterator, bool>
inline

Try to emplace a new element in the map if there is not already one with the corresponding key.

Perfectly forwards the provided arguments into the constructor of the key and value if an appropriate element does not already exist.

Template Parameters
ArgsThe types of the initializers for the mapped type. Must satisfy std::is_constructible<Value, Args&&...>.
SfinaeKeyThe key type, used to delete this overload if the key is not copy/move constructible
Parameters
keyThe key for which to insert or assign an element
argsThe values with which to construct the mapped value
Returns
std::pair<iterator, bool> A pair whose second element will be true if the emplace happened. The first element will be an iterator pointing to the element corresponding to key : the existing element if the insert did not happen, or the new element if it did.
Precondition
contains(key) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons or constructors of Key and Value .

◆ try_emplace() [2/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename... Args, typename SfinaeKey = Key, constraints< std::enable_if_t< std::is_copy_constructible< SfinaeKey >::value >, std::enable_if_t< std::is_constructible< Value, Args &&... >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_emplace ( Key const & key,
Args &&... args ) -> std::pair<iterator, bool>
inline

Try to emplace a new element in the map if there is not already one with the corresponding key.

Perfectly forwards the provided arguments into the constructor of the key and value if an appropriate element does not already exist.

Template Parameters
ArgsThe types of the initializers for the mapped type. Must satisfy std::is_constructible<Value, Args&&...>.
SfinaeKeyThe key type, used to delete this overload if the key is not copy/move constructible
Parameters
keyThe key for which to insert or assign an element
argsThe values with which to construct the mapped value
Returns
std::pair<iterator, bool> A pair whose second element will be true if the emplace happened. The first element will be an iterator pointing to the element corresponding to key : the existing element if the insert did not happen, or the new element if it did.
Precondition
contains(key) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons or constructors of Key and Value .

◆ try_emplace() [3/3]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, typename... Args, constraints< std::enable_if_t< transparent_insertion_supported< OtherKey > >, std::enable_if_t<!decays_to_v< OtherKey, Key > >, std::enable_if_t< std::is_constructible< Key, OtherKey && >::value >, std::enable_if_t< std::is_constructible< Value, Args &&... >::value > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::try_emplace ( OtherKey && key,
Args &&... args ) -> std::pair<iterator, bool>
inline

Try to emplace a new element in the map if there is not already one with an equivalent key.

Perfectly forwards the provided arguments into the constructor of the key and value if an appropriate element does not already exist.

Template Parameters
ArgsThe types of the initializers for the mapped type. Must satisfy std::is_constructible<Value, Args&&...>.
OtherKeyThe key type. Must satisfy decays_to_v<K, Key> || transparent_comparison_supported<K> and std::is_constructible<Key, K&&>
Parameters
keyThe key for which to insert or assign an element
argsThe values with which to construct the mapped value
Returns
std::pair<iterator, bool> A pair whose second element will be true if the emplace happened. The first element will be an iterator pointing to the element corresponding to key : the existing element if the insert did not happen, or the new element if it did.
Precondition
contains(key) is true, or size()<Capacity, else ARENE_PRECONDITION violation.
Exceptions
Anyexception thrown by the comparisons or constructors of Key and Value .

◆ upper_bound() [1/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::upper_bound ( Key const & key) const -> const_iterator
inlinenoexcept

Find the first element which is greater than a given key.

Parameters
keyThe key to search for.
Returns
const_iterator to the first element which is greater than key , or end() if there is no such element.

◆ upper_bound() [2/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::upper_bound ( Key const & key) -> iterator
inlinenoexcept

Find the first element which is greater than a given key.

Parameters
keyThe key to search for.
Returns
iterator to the first element which is greater than key , or end() if there is no such element.

◆ upper_bound() [3/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::upper_bound ( OtherKey const & key) const -> const_iterator
inlinenoexcept

Find the first element which is greater than a given key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to search for.
Returns
const_iterator to the first element which is greater than key , or end() if there is no such element.

◆ upper_bound() [4/4]

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, constraints< std::enable_if_t< transparent_comparison_supported< OtherKey > > > = nullptr>
auto arene::base::inline_map< Key, Value, Capacity, Compare >::upper_bound ( OtherKey const & key) -> iterator
inlinenoexcept

Find the first element which is greater than a given key.

Template Parameters
OtherKeythe type of the key to find. Must satisfy is_transparent_comparator_for<Compare,Key,K> or is_transparent_three_way_comparator_for<Compare,Key,K> .
Parameters
keyThe key to search for.
Returns
iterator to the first element which is greater than key , or end() if there is no such element.

Friends And Related Symbol Documentation

◆ inline_map

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename OtherKey, typename OtherValue, std::size_t OtherCapacity, typename OtherCompare>
friend class inline_map
friend

◆ operator!=

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<size_type OtherCapacity, typename SfinaeValue = value_type, constraints< std::enable_if_t< is_equality_comparable_v< SfinaeValue > > > = nullptr>
ARENE_NODISCARD friend auto operator!= ( inline_map< Key, Value, Capacity, Compare > const & lhs,
inline_map< Key, Value, OtherCapacity, Compare > const & rhs ) -> bool
friend

Compares two maps for inequality of elements when mapped_value is not three-way-comparable.

Template Parameters
OtherCapacitythe capacity of rhs
SfinaeValuedummy template parameter to disable the operator if value_type is not equality comparable.
SfinaeKeydummy template parameter to enable the operator if key_Type is not three way comparable.
SfinaeMappedTypedummy template parameter to enable the operator if mapped_type is not three way comparable.
Parameters
lhsThe left hand operand to the comparison.
rhsThe right hand operand to the comparison.
Returns
bool Equivalent to !arene::base::equal(lhs.begin(),lhs.end(),rhs.begin(),rhs.end())

◆ operator==

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<size_type OtherCapacity, typename SfinaeValue = value_type, constraints< std::enable_if_t< is_equality_comparable_v< SfinaeValue > > > = nullptr>
ARENE_NODISCARD friend auto operator== ( inline_map< Key, Value, Capacity, Compare > const & lhs,
inline_map< Key, Value, OtherCapacity, Compare > const & rhs ) -> bool
friend

Compares two maps for equality of elements when mapped_value is not three-way-comparable.

Template Parameters
OtherCapacitythe capacity of rhs
SfinaeValuedummy template parameter to disable the operator if value_type is not equality comparable.
SfinaeKeydummy template parameter to enable the operator if key_type is not three way comparable.
SfinaeMappedTypedummy template parameter to enable the operator if mapped_type is not three way comparable.
Parameters
lhsThe left hand operand to the comparison.
rhsThe right hand operand to the comparison.
Returns
bool Equivalent to arene::base::equal(lhs.begin(),lhs.end(),rhs.begin(),rhs.end())

◆ value_at_index

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
template<typename Self, constraints< std::enable_if_t< decays_to_v< Self, inline_map > > > = nullptr>
auto value_at_index ( inline_map_passkey ,
Self & self,
std::uint16_t index ) -> conditional_t<std::is_const<std::remove_reference_t<Self>>::value, value_type const&, value_type&>
friend

Gets the value at an index.

Template Parameters
SelfDeduced-this type of the map.
Parameters
selfThe map
indexthe index in the map
Returns
reference to the value at the given index
Note
this is primarily used to provide minimal access to inline_map_reference_iterator

Member Data Documentation

◆ capacity

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
std::integral_constant<size_type, Capacity> arene::base::inline_map< Key, Value, Capacity, Compare >::capacity {}
staticconstexpr

map capacity

◆ max_size

template<typename Key, typename Value, std::size_t Capacity, typename Compare = compare_three_way>
std::integral_constant<size_type, Capacity> arene::base::inline_map< Key, Value, Capacity, Compare >::max_size {}
staticconstexpr

Get the maximum number of elements in the map, Capacity.


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