3 ms·
Copy initialization does not mean that the copy constructor is called. It is the correct term for an expression `T a = ...;`, which can often result in the copy
by jdrek1 4y ago
Copy initialization does not mean that the copy constructor is called. It is the correct term for an expression `T a = ...;`, which can often result in the copy constructor being called but does not have to. In this case it's mandatory copy elision from a prvalue, which leads to only one constructor being called.
- einpoklum 4y agoYou are absolutely correct. It turns out "copy initialization is the formal term used. It's kind of stupid IMHO, since it may not be initialization by copying or using a copy of anything, but: https://en.cppreference.com/w/cpp/language/copy_initialization https://en.cppreference.com/w/cpp/language/copy_initializati... So I half-take-back my comment.