12#include <boost/serialization/array.hpp>
13#include <boost/serialization/base_object.hpp>
25 template<
class E,
class T>
26 class EnumArray :
public std::array<T, static_cast<std::size_t>(E::END)> {
27 using U =
typename std::underlying_type<E>::type;
28 using Arr = std::array<T, static_cast<std::size_t>(E::END)>;
33 T&
operator[](
const E& entry) {
return Arr::operator[](
static_cast<U>(entry)); }
41 const T&
operator[](
const E& entry)
const {
return Arr::operator[](
static_cast<U>(entry)); }
45 const T&
operator[](
U index)
const {
return Arr::operator[](index); }
48 operator Arr&()
const {
return *
this; }
52 template<
typename Archive>
55 ar& boost::serialization::base_object<Arr>(*
this);
const T & operator[](U index) const
Constant access operator, indexed by underlying index type.
T & operator[](U index)
Mutable access operator, indexed by underlying index type.
T & operator[](const E &entry)
Mutable access operator, indexed by enum entry.
friend class boost::serialization::access
typename std::underlying_type< E >::type U
Underlying type of enumeration.
const T & operator[](const E &entry) const
Constant access operator, indexed by enum entry.
std::array< T, static_cast< std::size_t >(E::END)> Arr
void serialize(Archive &ar, const unsigned int)