12#include <boost/serialization/array.hpp>
13#include <boost/serialization/base_object.hpp>
34 template<
class E,
class T>
35 class EnumArray :
public std::array<T, static_cast<std::size_t>(E::END)> {
36 using U =
typename std::underlying_type<E>::type;
37 using Arr = std::array<T, static_cast<std::size_t>(E::END)>;
43 return std::array<T, static_cast<std::size_t>(E::END)>::operator[](
static_cast<U>(entry));
47 T&
operator[](
U index) {
return std::array<T, static_cast<std::size_t>(E::END)>::operator[](index); }
52 return std::array<T, static_cast<std::size_t>(E::END)>::operator[](
static_cast<U>(entry));
57 const T&
operator[](
U index)
const {
return std::array<T, static_cast<std::size_t>(E::END)>::operator[](index); }
60 operator Arr&()
const {
return *
this; }
64 template<
typename Archive>
67 ar& boost::serialization::base_object<Arr>(*
this);
typename std::underlying_type< E >::type U
Underlying type of enumeration.
std::array< T, static_cast< std::size_t >(E::END)> Arr
void serialize(Archive &ar, const unsigned int)
T & operator[](const E &entry)
Mutable access operator, indexed by enum entry.
T & operator[](U index)
Mutable access operator, indexed by underlying index type.
const T & operator[](U index) const
Constant access operator, indexed by underlying index type.
friend class boost::serialization::access
const T & operator[](const E &entry) const
Constant access operator, indexed by enum entry.
TODO: SZh 8.11.2022: add selection of parameterisation.
EDummy
Dummy enum, representing an array with zero elements.