考虑以下代码:
class B;
class A
{
public:
A() {}
A(B &b);
};
class B {};
A::A(B &b) {}
int main()
{
B b;
const A &refa = b;// does this line create a temporary value?
return 0;
}
我的问题是:代码是否const A &refa = b;
创建临时值?
考虑以下代码:
class B;
class A
{
public:
A() {}
A(B &b);
};
class B {};
A::A(B &b) {}
int main()
{
B b;
const A &refa = b;// does this line create a temporary value?
return 0;
}
我的问题是:代码是否const A &refa = b;
创建临时值?