#include <iostream>
using namespace std;
struct A
{
template<typename T> A(T&&) { cout << "T&&" << endl; }
A(A&) { cout << "A&" << endl; }
A(const A&) { cout << "const A&" << endl; }
A(A&&) { cout << "A&&" << endl; }
A(const A&&) { cout << "const A&&" << endl; }
};
struct B
{
template<typename T> B(T&&) { cout << "T&&" << endl; }
B(B&) { cout << "B&" << endl; }
B(const B&) { cout << "const B&" << endl; }
B(B&&) { cout << "B&&" << endl; }
B(const B&&) = delete;
};
int main() {
A pi(3.14159); // T&&
const A answer(42); // T&&
A a1(pi); // A&
A a2(answer); // const A&
A a3(std::move(pi)); // A&&
A a4(std::move(answer)); // const A&&
B hello("Hello"); // T&&
const B world("World"); // T&&
B b1(hello); // B&
B b2(world); // const B&
B b3(std::move(hello)); // B&&
// B b4(std::move(world)); // error: const B&& is deleted
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IEEKewogICAgdGVtcGxhdGU8dHlwZW5hbWUgVD4gQShUJiYpIHsgY291dCA8PCAiVCYmIiAgICAgICA8PCBlbmRsOyB9CiAgICBBKEEmKSAgICAgICAgICAgICAgICAgICAgICAgeyBjb3V0IDw8ICJBJiIgICAgICAgIDw8IGVuZGw7IH0KICAgIEEoY29uc3QgQSYpICAgICAgICAgICAgICAgICB7IGNvdXQgPDwgImNvbnN0IEEmIiAgPDwgZW5kbDsgfQogICAgQShBJiYpICAgICAgICAgICAgICAgICAgICAgIHsgY291dCA8PCAiQSYmIiAgICAgICA8PCBlbmRsOyB9CiAgICBBKGNvbnN0IEEmJikgICAgICAgICAgICAgICAgeyBjb3V0IDw8ICJjb25zdCBBJiYiIDw8IGVuZGw7IH0KfTsKCnN0cnVjdCBCCnsKICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+IEIoVCYmKSB7IGNvdXQgPDwgIlQmJiIgICAgICAgPDwgZW5kbDsgfQogICAgQihCJikgICAgICAgICAgICAgICAgICAgICAgIHsgY291dC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