In a GoogleTechTalks video on Youtube, Bjarne Stroustrup talks about the upcoming C++0x standard. In the video he mentions the following example:
#include <iostream>
struct Sick
{
Sick(double d) { std::cout << d << "\n"; }
explicit Sick(int i) { std::cout << i << "\n"; }
};
int main()
{
Sick s1 = 2.1;
Sick s2(2.1);
}
Did he mean to place the explicit
keyword before Sick(double)
rather than Sick(int)
, in order to highlight problems associated with implicit conversions in certain contexts?