I find it quite convenient to have a class that basically acts like std::array, but is indexed by the values ββof some enum. I think itβs not very difficult to imagine how to implement it, say, it has this signature:
class enum_array <typename EnumT, typename ValueT, size_t N>
On the other hand, trying to implement all the standard functions std::array, I noticed that writing an overloaded function std::getfor such a class template is not so simple.
First of all, I believe that for this it is std::getnatural to only have the value of the above enumeration as an argument to the template, and because of it, most problems arise:
1) If I want to define such a function outside the class, I should do something like:
namespace std {
template <EnumT Index, typename EnumT, typename ValueT, size_t N>
EnumT &get (enum_array<EnumT, ValueT, N> &val)
, EnumT , ,
EnumT Index , , - , std::get std::array.
2) get enum_array , , , , enum_array. namespace std .
, : std::get , , ++?
( , , std::get std::array, )