vector函数内部重载了[],分别为:
Object &operator[] (int index)
{ return objects[index];}
const Object &operator[] (int index) const
{ return objects[index];}
调试了一下发现一般情况下调用的都是Object &operator[] (int index)。
函数const Object &operator[] (int index) const的调用,只发生在该类内部const函数调用该const函数。
我想问的是const Object &operator[] (int index) const的调用,除了类内部const函数调用const函数之外,还有其他的调用情况吗?