Ok well I'm trying to make sense of these two lines my professor wrote in an example program to simulate STL vectors:
Code:
T & operator[](size_type i) { return data[i]; }
const T & operator[](size_type i) const { return data[i]; }
I understand that the second one has a return type of const T so that the return value can only be used as an r-value but I don't understand why the 2nd const is there after the parameter list and not there in the first line if they both have the same implementation and don't modify anything...