鉴于
struct A
{
void a(void) { std::cout << "A" << std::endl; }
};
const A &a = A(); /* Make a copy of A and bind to a */
const A &b(A()); /* Does nothing */
a.a(); /* Prints A */
b.a(); /* Error, same as if b doesn't exist */
为什么第二种形式的“将临时绑定到const引用”似乎等同于无操作?
答案 0 :(得分:2)