How can I improve this design that forces me to declare a member function const and declare variables mutable?
问题 For some reason I am iterating over elements of a class in an std::set and would like to slightly modify the keys, knowing that the order will be unchanged. Iterators on std::set are const_iterators because if the key is modified, it might result in a bad order and therefore in set corruption. However I know for sure that my operations won't change the order of my elements in the set. For the moment, here is my solution: class Foo { public: Foo(int a, int b): a_(a),b_(b) {} ~Foo(){} bool