31 template<
typename Key,
typename Value,
size_t Size>
35 template<
typename Iterable>
36 constexpr
CMap(Iterable begin, Iterable end)
42 auto& first = m_map[index].first;
43 auto& second = m_map[index].second;
46 first = std::move(begin->first);
47 second = std::move(begin->second);
62 constexpr
const Value& at(
const Key& key)
const 64 const auto it = find(key);
65 if (it != m_map.cend())
71 throw std::range_error(
"Not Found");
75 constexpr
auto find(
const Key& key)
const 77 return std::find_if(m_map.cbegin(), m_map.cend(),
78 [&key](
const auto& pair) {
return pair.first == key; });
81 constexpr
size_t size()
const {
return Size; }
83 constexpr
auto cbegin()
const {
return m_map.cbegin(); }
84 constexpr
auto cend()
const {
return m_map.cend(); }
89 std::array<std::pair<Key, Value>, Size> m_map;
98 template<
typename Key,
typename Value, std::
size_t Size>
This class is designed to implement a constexpr version of std::map. The standard library std::map do...
Definition: Map.h:32
constexpr CMap(Iterable begin, Iterable end)
Definition: Map.h:36