#include #include #include #include int category(int&) { return 1; } int category(int&&) { return 2; } int main() { int n = 5; int&& r = std::move(n); assert(category(r) == 1); assert(category(std::move(r)) == 2); assert(n == 5); std::unique_ptr source(new int(42)); int* original = source.get(); std::unique_ptr target = std::move(source); assert(!source); assert(target.get() == original && *target == 42); std::cout << category(r) << ' ' << category(std::move(r)) << ' ' << *target << '\n'; }