7#include <magic_enum.hpp>
15 using namespace magic_enum;
20 template <
typename VALUE_TYPE,
typename ENUM_TYPE>
21 requires std::is_enum_v<ENUM_TYPE>
22 struct enum_array :
public std::array<VALUE_TYPE, magic_enum::enum_count<ENUM_TYPE>()>
24 using array_type = std::array<VALUE_TYPE, magic_enum::enum_count<ENUM_TYPE>()>;
26 using value_type = array_type::value_type;
27 using size_type = array_type::size_type;
28 using difference_type = array_type::difference_type;
29 using pointer = array_type::pointer;
30 using const_pointer = array_type::const_pointer;
31 using reference = array_type::reference;
32 using const_reference = array_type::const_reference;
33 using iterator = array_type::iterator;
34 using const_iterator = array_type::const_iterator;
35 using reverse_iterator = array_type::reverse_iterator;
36 using const_reverse_iterator = array_type::const_reverse_iterator;
41 return this->array_type::at(
static_cast<size_type
>(
pos));
45 return this->array_type::at(
static_cast<size_type
>(
pos));
49 return this->array_type::operator[](
static_cast<size_type
>(
pos));
53 return this->array_type::operator[](
static_cast<size_type
>(
pos));
constexpr auto bit_count
Equal to the number of bits in the type.
Primary namespace for everything in this library.
Same as std::array except it takes an enum type instead of the size, and uses magic_enum to determine...