Apparently referencing the superclass by unqualified name is not allowed

This commit is contained in:
2020-01-12 12:33:58 -05:00
parent c5dedeb2a7
commit fa25beae6d

View File

@@ -15,9 +15,10 @@
template<typename E, typename T, int n>
struct enum_map_impl : public std::array<T, n> {
// Since the superclass is a dependent type we need to explicitly import these to use them in the class definition
using typename array::reference;
using typename array::const_reference;
using typename array::size_type;
using super_type = std::array<T, n>;
using typename super_type::reference;
using typename super_type::const_reference;
using typename super_type::size_type;
enum_map_impl() = default;
enum_map_impl(std::initializer_list<T> l) {
std::copy(l.begin(), l.end(), this->begin());
@@ -26,9 +27,9 @@ struct enum_map_impl : public std::array<T, n> {
const_reference at(size_type pos) const = delete;
reference operator[](size_type pos) = delete;
const_reference operator[](size_type pos) const = delete;
reference at(E pos) {return this->array::at(static_cast<int>(pos));};
const_reference at(E pos) const {return this->array::operator[](static_cast<int>(pos));};
reference operator[](E pos) {return this->array::operator[](static_cast<int>(pos));};
reference at(E pos) {return super_type::at(static_cast<int>(pos));};
const_reference at(E pos) const {return super_type::operator[](static_cast<int>(pos));};
reference operator[](E pos) {return super_type::operator[](static_cast<int>(pos));};
const_reference operator[](E pos) const = delete;
static const std::array<E, n> keys() {
static std::array<E, n> keys;