lundi 17 mars 2014

copy initialization topic




IIRC, this is direct initialization:

::std::string s{ "abc" };

; this is copy initialization:

::std::string s = "abc";

. So, it seems that only with the equals sign one gets copy
initialization.

Now, I am looking at this:

::std::string abc{ "abc" };
::std::string s{ abc };

. In the second line »::std::string s{ abc };«, this string
»abc« seems to be /copied/ into the string s. Is it still
correct to say that this is not copy initialization, even
though it involves a copy, because there is no equals sign
in it?







Aucun commentaire:

Enregistrer un commentaire