Today I was surprised by this paragraph at cppreference:
Converting constructor
A constructor that is not declared with the specifier explicit and which can be called with a single parameter (until C++11) is called a converting constructor.
The "(until C++11)" bit seems to be referring to the phrase "which can be called with a single parameter".
I didn't know this changed at C++11. What's the change? What kind of "converting constructor" can take more than one argument? (If that's what it is referring to.)
(I suppose it could be referring to constructors that have more than one argument but those extra arguments - or all of them - have default values. But default values for arguments have been in C++ forever. So did something change there - before C++11 you couldn't implicitly convert with a constructor that took default arguments? But this example at wandbolt shows that that did work in C++03.)
Aucun commentaire:
Enregistrer un commentaire