c++ - index operator constness -


Why do we need two? In what situation the following operator [] is called?

  class X {public: // ... int and operator [] (int index); Const int and operator [] (int index) const; };  

  fu (x) {x [0]; // The non-construction indexer is called the bar (constant x) {x [0]; // const constant is called}  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -