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

A reference class to an inline_map object, with size-erased type. More...

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

Public Types

using compare_type = Compare
 compare type of the map
 
using const_iterator = inline_map_reference_iterator<map_base_type, true>
 const iterator type of the underlying map
 
using const_ops_type = inline_map_reference_detail::const_operations<map_base_type>
 alias to const operations type
 
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 iterator = inline_map_reference_iterator<map_base_type, false>
 iterator type of a reference to the map
 
using key_type = Key
 key type of the map
 
using map_base_type = inline_map_detail::inline_map_base<Key, Value, Compare>
 alias to the map base class
 
using mapped_type = Value
 mapped type of the map
 
using ops_type = inline_map_reference_detail::operations<map_base_type>
 alias to non-const operations type
 
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
 size type of the map
 
using value_type = std::pair<Key const, Value>
 value type of the map
 

Public Member Functions

template<std::size_t Capacity, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
 inline_map_reference (inline_map< Key, Value, Capacity, Compare > &map) noexcept
 construct an inline_map_reference of a map
 
template<std::size_t Capacity, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t<!AreExceptionsEnabled > > = nullptr>
 inline_map_reference (inline_map< Key, Value, Capacity, Compare > &map) noexcept
 construct an inline_map_reference of a map
 
template<std::size_t Capacity>
 inline_map_reference (inline_map< Key, Value, Capacity, Compare > const &&)=delete
 construct an inline_map_reference of a map
 
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
auto at (key_type const &key) const noexcept(false) ->
 obtain a reference to the mapped value for the specified key
 
auto begin () const noexcept ->
 obtain an iterator referring to the beginning of the sorted range of elements
 
auto clear () const noexcept ->
 destroy all elements in the assocaited inline_map
 
auto const_ops_ptr () const noexcept -> const_ops_type const *
 obtain a pointer to the const operations
 
auto end () const noexcept ->
 obtain an iterator referring to one past the last element in the sorted range of elements
 
auto equal_range (key_type const &key) const noexcept(comparison_is_noexcept) ->
 find the sequence of elements whose keys compare equivalent to a given key
 
auto erase (const_iterator first, const_iterator last) const noexcept ->
 remove elements in the specified range
 
auto erase (const_iterator pos) const noexcept ->
 remove the element at the specified position
 
auto erase (key_type const &key) const noexcept(comparison_is_noexcept) ->
 remove element with the corresponding key, if there is one
 
auto find (key_type const &key) const noexcept(comparison_is_noexcept) ->
 obtain an iterator to the first element with a given key
 
auto insert (value_type const &value) const noexcept(false) ->
 insert an element in the map
 
auto insert_or_assign (key_type const &key, mapped_type const &mapped) const noexcept(false) ->
 insert an element in the map or update an existing element
 
auto lower_bound (key_type const &key) const noexcept(comparison_is_noexcept) ->
 find the first element which is not less than a given key
 
auto map_ptr () const noexcept -> map_base_type *
 obtain a pointer to the map base
 
auto operator[] (key_type const &key) const noexcept(false) ->
 obtain a reference to the mapped value for the specified key
 
auto ops_ptr () const noexcept -> ops_type const *
 obtain a pointer to the non-const operations
 
auto upper_bound (key_type const &key) const noexcept(comparison_is_noexcept) ->
 find the first element which is greater than a given key
 

Detailed Description

template<class Key, class Value, class Compare>
class arene::base::inline_map_reference< Key, Value, Compare >

A reference class to an inline_map object, with size-erased type.

Template Parameters
KeyThe key type for the map
ValueThe mapped type for the map
CompareThe comparison function
Precondition
The comparison must provide a strict ordering over the values of Key

Member Typedef Documentation

◆ compare_type

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::compare_type = Compare

compare type of the map

◆ const_iterator

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::const_iterator = inline_map_reference_iterator<map_base_type, true>

const iterator type of the underlying map

◆ const_ops_type

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::const_ops_type = inline_map_reference_detail::const_operations<map_base_type>

alias to const operations type

◆ const_reverse_iterator

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, 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.

◆ iterator

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::iterator = inline_map_reference_iterator<map_base_type, false>

iterator type of a reference to the map

◆ key_type

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::key_type = Key

key type of the map

◆ map_base_type

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::map_base_type = inline_map_detail::inline_map_base<Key, Value, Compare>

alias to the map base class

◆ mapped_type

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::mapped_type = Value

mapped type of the map

◆ ops_type

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::ops_type = inline_map_reference_detail::operations<map_base_type>

alias to non-const operations type

◆ reverse_iterator

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, 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<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::size_type = typename map_base_type::size_type

size type of the map

◆ value_type

template<class Key, class Value, class Compare>
using arene::base::inline_map_reference< Key, Value, Compare >::value_type = std::pair<Key const, Value>

value type of the map

Constructor & Destructor Documentation

◆ inline_map_reference() [1/3]

template<class Key, class Value, class Compare>
template<std::size_t Capacity, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
arene::base::inline_map_reference< Key, Value, Compare >::inline_map_reference ( inline_map< Key, Value, Capacity, Compare > & map)
inlineexplicitnoexcept

construct an inline_map_reference of a map

Template Parameters
Capacitycapacity of the inline_map
Parameters
mapinline_map to reference

◆ inline_map_reference() [2/3]

template<class Key, class Value, class Compare>
template<std::size_t Capacity, bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t<!AreExceptionsEnabled > > = nullptr>
arene::base::inline_map_reference< Key, Value, Compare >::inline_map_reference ( inline_map< Key, Value, Capacity, Compare > & map)
inlineexplicitnoexcept

construct an inline_map_reference of a map

Template Parameters
Capacitycapacity of the inline_map
Parameters
mapinline_map to reference

◆ inline_map_reference() [3/3]

template<class Key, class Value, class Compare>
template<std::size_t Capacity>
arene::base::inline_map_reference< Key, Value, Compare >::inline_map_reference ( inline_map< Key, Value, Capacity, Compare > const && )
explicitdelete

construct an inline_map_reference of a map

Template Parameters
Capacitycapacity of the inline_map

Deleted overload for rvalue references.

Member Function Documentation

◆ at()

template<class Key, class Value, class Compare>
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
auto arene::base::inline_map_reference< Key, Value, Compare >::at ( key_type const & key) const ->
inline

obtain a reference to the mapped value for the specified key

Parameters
keythe key to search for
Returns
reference to the mapped value
Exceptions
std::out_of_rangeif contains(key) is false
anyexception thrown by the comparisons

◆ begin()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::begin ( ) const ->
inlinenoexcept

obtain an iterator referring to the beginning of the sorted range of elements

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

◆ clear()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::clear ( ) const ->
inlinenoexcept

destroy all elements in the assocaited inline_map

Postcondition
size() == 0
Returns
void

◆ const_ops_ptr()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::const_ops_ptr ( ) const -> const_ops_type const*
inlinenoexcept

obtain a pointer to the const operations

Returns
pointer to the const operations

◆ end()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::end ( ) const ->
inlinenoexcept

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

Returns
iterator one past the last element in the sequence

◆ equal_range()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::equal_range ( key_type const & key) const ->
inlinenoexcept

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

Parameters
keythe key to search for
Returns
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/3]

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::erase ( const_iterator first,
const_iterator last ) const ->
inlinenoexcept

remove elements in the specified range

Parameters
firstbeginning of the range of elements to remove
lastend of the range of elements to remove
Precondition
[first, last) is a valid range in map
Returns
iterator after the removed element

◆ erase() [2/3]

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::erase ( const_iterator pos) const ->
inlinenoexcept

remove the element at the specified position

Parameters
positerator referring to the element to remove
Precondition
pos must be a dereferencable iterator referring to an element in map
Returns
iterator after the removed element

◆ erase() [3/3]

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::erase ( key_type const & key) const ->
inlinenoexcept

remove element with the corresponding key, if there is one

Parameters
keyThe key to erase
Returns
iterator after the removed element, or end if there is no element was removed

◆ find()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::find ( key_type const & key) const ->
inlinenoexcept

obtain an iterator to the first element with a given key

Parameters
keythe key to search for
Returns
iterator to the first element equal to key, or end() if the element is not found

◆ insert()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::insert ( value_type const & value) const ->
inline

insert an element in the map

Parameters
valuethe value to insert

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

Returns
std::pair<iterator, bool> whose first element is the key equivalent to value.first, and whose second element is a boolean with a value of true if the element was inserted or false if not.
Precondition
contains(value.first) is true, or size() < Capacity of the inline_map
Exceptions
anyexception thrown by the comparisons, or the copy constructor of value_type

◆ insert_or_assign()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::insert_or_assign ( key_type const & key,
mapped_type const & mapped ) const ->
inline

insert an element in the map or update an existing element

Parameters
keythe key for which to insert or assign an element
mappedthe value to associate with key

If key is contained in the inline_map, updates the associated value by copy-assigning mapped. If key is not contained in the inline_map, constructs a new element in the inline_map by copying key and mapped.

Returns
pair containing an iterator to the element in the map and boolean that is true if the element was inserted and false if not.
Precondition
contains(key) is true, or size() < Capacity of the inline_map
Exceptions
anyexception thrown by the comparisons, the move constructor of key_type or the constructor or assignment operator of value_type

◆ lower_bound()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::lower_bound ( key_type const & key) const ->
inlinenoexcept

find the first element which is not less than a given key

Parameters
keythe key to search for
Returns
iterator to the first element which is not less than key, or end() if there is no such element

◆ map_ptr()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::map_ptr ( ) const -> map_base_type*
inlinenoexcept

obtain a pointer to the map base

Returns
pointer to the map base

◆ operator[]()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::operator[] ( key_type const & key) const ->
inline

obtain a reference to the mapped value for the specified key

Parameters
keythe key to search for
Returns
reference to the mapped value. If key did not exist in the map, then a default constructed mapped_type is inserted into the map at key and a reference to it is returned.
Exceptions
annyexception thrown by the comparisons, and exception throw by the copy-constructor of key_type, or the default-constructor of mapped_type
Precondition
size() < Capacity if contains(key) is false

◆ ops_ptr()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::ops_ptr ( ) const -> ops_type const*
inlinenoexcept

obtain a pointer to the non-const operations

Returns
pointer to the non-const operations

◆ upper_bound()

template<class Key, class Value, class Compare>
auto arene::base::inline_map_reference< Key, Value, Compare >::upper_bound ( key_type const & key) const ->
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

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