operator[] difference of const and non-const
I was reading a tutorial which have a header including operator[], of course an overload of the latter, having a version const and non-const, respectively:
Code:
T const & operator[] (iteratorClassName<T> const &) const;
T & operator[] (iteratorClassName<T> const &);
This got me wondering what's the real difference between the 2.
... whoah! I'm getting too tired. Anyway I'll do a follow-up poast but my question will remain the same, is there a difference in the code between the 2 beside something no-so-important like one display an error cerr << "wrong use..." and the other make a log clog << "successful...". IMHO, such case would be for where one of the 2 (const or non-const) shouldn't be used.
Is there some cases where the content of the operator[] would be different at is core, a major difference (again between const and non-const) ?
Than
ks and it's ok if you don't understand, don't worry I'll come back to this.