Step 5 of 8
Non-copyable classes
Sometimes copying makes no sense (a file handle, a network socket, a unique game session). Say so explicitly with = delete, and the compiler rejects any attempt to copy:
class Session {
public:
Session(const Session&) = delete;
Session& operator=(const Session&) = delete;
};
Your turn: make Lock non-copyable. The tests check it at compile time with std::is_copy_constructible_v.
Previous: The copy problem Next: Copy assignment with copy-and-swap