xbmc
|
This class is designed to implement a constexpr version of std::map. The standard library std::map doesn't allow constexpr (and it doesn't look like it will be implemented in the future). This class utilizes std::array and std::pair as they allow constexpr. More...
#include <Map.h>
Public Member Functions | |
template<typename Iterable > | |
constexpr | CMap (Iterable begin, Iterable end) |
constexpr const Value & | at (const Key &key) const |
constexpr auto | find (const Key &key) const |
constexpr size_t | size () const |
constexpr auto | cbegin () const |
constexpr auto | cend () const |
This class is designed to implement a constexpr version of std::map. The standard library std::map doesn't allow constexpr (and it doesn't look like it will be implemented in the future). This class utilizes std::array and std::pair as they allow constexpr.
When using this class you should use the helper make_map instead of constructing this class directly. For example: constexpr auto myMap = make_map<int, std::string_view>({{1, "one"}});
This class is useful for mapping enum values to strings that can be compile time checked. This also helps with heap usage.
Lookups have linear complexity, so should not be used for "big" maps.
|
inline |