- #include <utility>
- class T {
- T &operator=(const T&) = delete; // noncopyable
- T(const T&) = delete; // noncopyable
- public:
- T& operator=(T&&) = default; // moveable
- T() = default; // default constructor
- };
- T &&f() {
- return std::move(T());
- }
- int main() {
- T t;
- t = f();
- }