ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.17k stars 388 forks source link

Outdated documentation for the unordered_map's operator[] #770

Closed tocic closed 12 months ago

tocic commented 12 months ago

The doc says there is a member operator[](key_parameter_t key) const, but I can't find it here, and my sample program doesn't compile:

#include <etl/unordered_map.h>

int main() {
    const etl::unordered_map<int, int, 1> x{{1,1}};
    x[0];
}

error: passing 'const etl::unordered_map<int, int, 1>' as 'this' argument discards qualifiers

jwellbelove commented 12 months ago

I have updated the documentation

tocic commented 12 months ago

Looks like the sentence "Returns a reference or const reference to the indexed element" should be changed to "Returns a reference to the indexed element".

jwellbelove commented 12 months ago

Thanks, fixed.