I want to write a line of code that returns a pointer to this, because of an array (std::vector<foo**>). I thought of using a reference (&this), but it didn't work.
If any clarification is needed, let me know.
EDIT: To clarify what I'm doing, I'm trying to access the object directly using the array. Like so: (*ARRAY.at(i))->foo("bar");. Some people say it is impossible to make a pointer. If so, how would I access the object directly using the array?
std::vector<foo**>looks like a very bad idea.thisis a pointer, specifically to the instance of the object. To return a pointer tothisimplies changing the internal instance from outside the class. That would probably be bad. What are you really doing?&this), but it didn't work." Do you mean*this?