template<typename Container>
MapAdapterBase class

Dict-like data structure by std::vector and Range.

Derived classes

template<typename Container>
class MapAdapter
Dict-like data structure by std::vector and Range.

Public types

using key_type = size_t
using mapped_type = typename Container::value_type
using value_type = std::pair<key_type, mapped_type>

Constructors, destructors, conversion operators

MapAdapterBase(Container& lst) explicit
Construct a new MapAdapter object.

Public functions

auto operator[](const key_type& key) -> mapped_type&
auto operator[](const key_type& key) const -> const mapped_type&
auto at(const key_type& key) const -> const mapped_type&
auto contains(const key_type& key) const -> bool
auto size() const -> size_t

Public variables

py::Range<key_type> _rng
Container& _lst

Function documentation

template<typename Container>
MapAdapterBase<Container>::MapAdapterBase(Container& lst) explicit

Construct a new MapAdapter object.

Parameters
lst in The parameter lst is a reference to a container object.

The function constructs a new MapAdapter object with a given container.

template<typename Container>
mapped_type& MapAdapterBase<Container>::operator[](const key_type& key)

Parameters
key in The parameter "key" is of type "key_type", which is a data type that represents the key used to search for an element in the container.
Returns The operator[] is returning a reference to the mapped_type value associated with the given key.

The function overloads the subscript operator to access and modify the value associated with a given key in a map-like container.

template<typename Container>
const mapped_type& MapAdapterBase<Container>::operator[](const key_type& key) const

Parameters
key in The parameter "key" is of type "key_type", which is a data type that represents the key used to search for an element in the container.
Returns a constant reference to the value associated with the given key in the _lst container.

The function returns a constant reference to the value associated with the given key in a map-like container.

template<typename Container>
const mapped_type& MapAdapterBase<Container>::at(const key_type& key) const

Returns a constant reference to the value associated with the given key.

The function at() returns a constant reference to the value associated with a given key in a map.

template<typename Container>
bool MapAdapterBase<Container>::contains(const key_type& key) const

Parameters
key in The parameter "key" is of type "key_type", which is a data type that represents the key used to search for an element in the container.
Returns a boolean value. It will return true if the key is contained in the data structure, and false otherwise.

The function checks if a given key is present in a data structure.

template<typename Container>
size_t MapAdapterBase<Container>::size() const

Returns The size of the _rng object is being returned.

The size() function returns the size of the _rng container.