template<typename Container>
MapConstAdapter class

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>
using E = decltype(py::const_enumerate(std::declval<Container>()))

Constructors, destructors, conversion operators

MapConstAdapter(const Container& lst) explicit

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
auto begin() const -> auto
auto end() const -> auto

Function documentation

template<typename Container>
MapConstAdapter<Container>::MapConstAdapter(const Container& lst) explicit

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

The function constructs a MapConstAdapter object using a given container.

template<typename Container>
mapped_type& MapConstAdapter<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& MapConstAdapter<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& MapConstAdapter<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 MapConstAdapter<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 MapConstAdapter<Container>::size() const

Returns The size of the _rng object is being returned.

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

template<typename Container>
auto MapConstAdapter<Container>::begin() const

Returns The begin() function is returning an iterator pointing to the beginning of the mapview container.

The function returns an iterator pointing to the beginning of the mapview.

template<typename Container>
auto MapConstAdapter<Container>::end() const

Returns The end iterator of the mapview.

The function returns an iterator pointing to the end of the mapview.