Is a buffer created here?
So I have an overloaded operator << implemented as follows:
The operator is a friend of the Position class.
ostream& operator << (ostream& os, const Position& p)
os << "(" << p.x << ", " << p.y << ")";
I found this as a solution when I was trying to find an easy way to print out a description of my objects in main() by just writing cout << object << endl; however I wasn't able to find an explanation that helped me understand what was actually happening with the streams and how everything was being processed etc.
In regards to the stack, heap and buffers, what is happening when I call my << operator in the following way:
Is a buffer holding the "(" << p.x << ", " << p.y << ")" string I put together created in the stack when a Position object is created? or what is the sequence of events to retrieving it?
cout << PositionObject << endl;
Also, if a buffer is not created, can someone give me an example of when one is created other than an array?