class Foo
{
};
Foo f;
Foo g = f; // (*)
My question is, what is being called in the line marked with (*) ? Is it the default
g is actually created as a copy of f.
A simple way to remember what = actually means, is just answer the question: is g already existing?
{
Foo g; //g construction ends here (at ';')
g = f; // assignment (the g previous value is replaced)
}
{
Foo g = f; //copy (same as Foo g(f): there is no "previous g" here)
}