diff --git a/src/core/convertible_through_base.hpp b/src/core/convertible_through_base.hpp index 62ee487beb..97c0e7e398 100644 --- a/src/core/convertible_through_base.hpp +++ b/src/core/convertible_through_base.hpp @@ -37,12 +37,16 @@ concept ConvertibleThroughBaseOrTo = std::is_convertible_v || Convertibl template class TypedIndexContainer : public Container { public: + Container::reference at(size_t pos) = delete; Container::reference at(const Index &pos) { return this->Container::at(pos.base()); } + Container::const_reference at(size_t pos) const = delete; Container::const_reference at(const Index &pos) const { return this->Container::at(pos.base()); } + Container::reference operator[](size_t pos) = delete; Container::reference operator[](const Index &pos) { return this->Container::operator[](pos.base()); } + Container::const_reference operator[](size_t pos) const = delete; Container::const_reference operator[](const Index &pos) const { return this->Container::operator[](pos.base()); } }; diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp index 35c40978ab..b8d4d8889b 100644 --- a/src/core/enum_type.hpp +++ b/src/core/enum_type.hpp @@ -246,12 +246,16 @@ public: template class EnumClassIndexContainer : public Container { public: + Container::reference at(size_t pos) = delete; Container::reference at(const Index &pos) { return this->Container::at(to_underlying(pos)); } + Container::const_reference at(size_t pos) const = delete; Container::const_reference at(const Index &pos) const { return this->Container::at(to_underlying(pos)); } + Container::reference operator[](size_t pos) = delete; Container::reference operator[](const Index &pos) { return this->Container::operator[](to_underlying(pos)); } + Container::const_reference operator[](size_t pos) const = delete; Container::const_reference operator[](const Index &pos) const { return this->Container::operator[](to_underlying(pos)); } };