#include <digraphx/map_adapter.hpp>
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>
auto MapConstAdapter<Container>:: end() const
Returns | The end iterator of the mapview. |
---|
The function returns an iterator pointing to the end of the mapview.