P
pauldepstein
From page 477 of 4th edition of C++ Primer.
"Direct-initialization directly invokes the constructor matched by the
arguments. Copy-initialization always involves the copy-constructor."
It occurs to me that the "constructor matched by the arguments" might
be the copy-constructor. In this case, I would think copy-
initialization and direct-initialization are exactly the same. My
concern (and reason for this posting) is that I haven't seen anyone
say the same thing.
For example, does std::string null_book = "99"; mean the same
as std::string null_book("99"); ? (On my compiler, they behave the
same way.) And would the behaviour always be the same if std::string
is replaced by another class?
Paul Epstein
"Direct-initialization directly invokes the constructor matched by the
arguments. Copy-initialization always involves the copy-constructor."
It occurs to me that the "constructor matched by the arguments" might
be the copy-constructor. In this case, I would think copy-
initialization and direct-initialization are exactly the same. My
concern (and reason for this posting) is that I haven't seen anyone
say the same thing.
For example, does std::string null_book = "99"; mean the same
as std::string null_book("99"); ? (On my compiler, they behave the
same way.) And would the behaviour always be the same if std::string
is replaced by another class?
Paul Epstein