struct A{
A(){}
};
struct B{
B(const A& a){}
};
int main()
{
//Originally I would like to write down below code
A a;
B b(a);
//Unfortunately I end up with below code by accident and there is no compile error
//I have figured out the below does not create temporary A and call B constructor to
//create B as the above codes,
//it declares a function with return value B, name b,
//and some input parameter, my question is 1) what the input parameter is ?
//2) How to implement such a function.
B b(A()); // There is no global function A() in my test case.
}
问题是在评论中,我希望有人能帮助我理解它。非常感谢你。声明一个具有类构造函数作为函数参数的函数
相关:[最令人烦恼的解析](http://en.wikipedia.org/wiki/Most_vexing_parse)。 – dasblinkenlight 2014-10-20 21:33:02