ACE
6.1.0
|
Helper class to disable copy construction and assignment. More...
#include <Copy_Disabled.h>
Public Member Functions | |
ACE_Copy_Disabled (void) | |
Default constructor. | |
Private Member Functions | |
ACE_Copy_Disabled (const ACE_Copy_Disabled &) | |
ACE_Copy_Disabled & | operator= (const ACE_Copy_Disabled &) |
Helper class to disable copy construction and assignment.
Classes used to control OS and other resources are not "canonical", i.e. they have their copy constructor and assignment operators disabled. This is often done by making the copy constructor and assignment operators private, effectively disallowing copying by clients of the class (including derived classes). If the copy constructor and assingment operators are left unimplemented then the class itself cannot make any copies of its instances, because it would result in link errors.
To use this class simply use private inheritance:
class Foo : private ACE_Copy_Disabled { // code here };
ACE_Copy_Disabled::ACE_Copy_Disabled | ( | void | ) |
Default constructor.
ACE_Copy_Disabled::ACE_Copy_Disabled | ( | const ACE_Copy_Disabled & | ) | [private] |
ACE_Copy_Disabled& ACE_Copy_Disabled::operator= | ( | const ACE_Copy_Disabled & | ) | [private] |