Assume I have this code
T object(other);
It is direct initialization or copy initialization? Based on the rule of direct initialization :
T object ( arg ); initialization with a nonempty parenthesized list of expressions
It is direct initialization.
But I saw someone said:
- It is copy initialization when
object
andother
is same type. - It is direct initialization when
object
andother
is different type.
I don't know which is correct.
All forms of
T object(other);
are direct initialization. Direct initialization is defined in [dcl.init.general]/15 as:emphasis mine
Which covers
T object(other);
Copy intialization is define in [dcl.init.general]/14 as:
T object(other);
is not covered so it is not copy initialization.