C++0x Initialization Lists
Loading...
9,733
Top Comments
see all
All Comments (15)
-
@tpr712 Is Bjarne Stroustrup a fan of yours?
-
cool video
-
@tpr712 Why is he your biggest fan? Whats so great about you?
-
@correaalf The explicit keyword should be placed before "Sick(double);" for the example to make sense.
-
*
sick s = 2.1
-
-
I agree. I don't know exactly what is his point near 21:20. But he is wrong I tried this, and printed "sick(double)".
struct sick{
sick(double){std::cout<<"sick(
double)"<<std::endl;} explicit sick(int){std::cout<<"explicit sick(int)"<<std::endl;}
};
int main(){
sick s(2.1);
}
-
Indeed. Both gcc 4.4.0 and cl.exe (visual c++ 2009) both call the non-explicit double constructor
Loading...
Bjarne is my biggest fan
tpr712 2 years ago 8
I also think he mixed up the Sick example...
namelessonehr 2 years ago 3