qb
2.0.0.0
C++17 Actor Framework
|
Base class to make derived classes non-copyable. More...
#include <nocopy.h>
Public Member Functions | |
nocopy ()=default | |
Default constructor. | |
nocopy (nocopy const &)=delete | |
Deleted copy constructor. | |
nocopy (nocopy const &&)=delete | |
Deleted move constructor. | |
nocopy & | operator= (nocopy const &)=delete |
Deleted copy assignment operator. | |
nocopy & | operator= (nocopy &&)=delete |
Deleted move assignment operator. |
Base class to make derived classes non-copyable.
Classes that inherit from this struct (usually via private inheritance) will have their copy constructor and copy assignment operator deleted, effectively preventing instances of the derived class from being copied. Their move constructor and move assignment operator are also deleted here to enforce non-movable semantics by default as well, unless explicitly re-enabled by the derived class.
This is useful for classes that manage unique resources (like file handles, network connections, or actor identities) where copying would be complex, semantically incorrect, or resource-intensive.
Usage example:
|
default |
Default constructor.
Allows derived classes to be default-constructed if appropriate.
|
delete |
Deleted copy constructor.
Prevents copying of derived class instances.
|
delete |
Deleted move constructor.
Prevents moving of derived class instances by default.
Deleted copy assignment operator.
Prevents copy assignment of derived class instances.