Accessing the [] operator from a pointer

前端 未结 7 730
北海茫月
北海茫月 2020-11-30 02:52

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

7条回答
  •  执念已碎
    2020-11-30 03:29

    return VecPtr->operator[](0);
    

    ...will do the trick. But really, the (*VecPtr)[0] form looks nicer, doesn't it?

提交回复
热议问题