diff --git a/map/fixed.hpp b/map/fixed.hpp index 2e46e659..bff0803a 100644 --- a/map/fixed.hpp +++ b/map/fixed.hpp @@ -112,6 +112,17 @@ namespace cruft::map { } + //--------------------------------------------------------------------- + mapped_type const& operator[] (KeyT const &key) const + { + ComparatorT cmp {}; + for (auto &i: *this) + if (cmp (i.first, key)) + return i.second; + throw std::out_of_range ("Invalid key"); + } + + //--------------------------------------------------------------------- mapped_type& operator[] (KeyT const &key) {