If I define a pointer to an object that defines the [] operator, is there a direct way to access this operator from a pointer?
[]
For example, in the follo
You could do any of the following:
#include int main () { std::vector v(1,1); std::vector* p = &v; p->operator[](0); (*p)[0]; p[0][0]; }
By the way, in the particular case of std::vector, you might also choose: p->at(0), even though it has a slightly different meaning.
std::vector
p->at(0)