How to Ensure a Class is not Copyable or Movable -- Sandor Dargo
The topic of this post is to show different ways to ensure that a class is either non-moveable or non-copyable.
How to Ensure a Class is not Copyable or Movable
by Sandor Dargo
From the article:
If we follow the classification proposed by Sebastian Theophil, we can talk about 4 different class types:
- value classes
- container classes
- resource classes
- singleton classes
While the first two should be regular classes offering both copy and move semantics, the latter two are different. One shouldn’t be able to copy resources and singletons probably shouldn’t be moveable.
It’s up to us to ensure that a class we create implements the right special member functions (SMFs from now on). And the Hinnant table is here to guide us.

In C++, associating member objects like properties or events with their containing class often requires passing this redundantly. This article explores a generalized, flexible solution using templates, variadic arguments, and deducing this to streamline ownership initialization without boilerplate.
Jonathan Müller attended the fall 2024 meeting of the ISO C++ standardization committee in Wrocław, Poland. This was the fifth meeting for the upcoming C++26 standard and the feature freeze for major C++26 features.