SimpleITK
1.2.4
|
An inheratable class to disable copying of a class. More...
#include <sitkNonCopyable.h>
Protected Member Functions | |
NonCopyable () | |
Private Member Functions | |
NonCopyable (const NonCopyable &) | |
NonCopyable & | operator= (const NonCopyable &) |
An inheratable class to disable copying of a class.
This class disable the implicit implementations of the assignment and copy constructor for derived classes. The instantiation of the default implementation for either method in a derived class will result in a compile-time error because they are private in this class. However, this policy is not absolute for derived classes because explicit implementation of these methods could be implemented.
An advatange this apporach has is the class heiarchy makes it obvious what the intent is, as compared to other appoaches.
For example you should not be able to copy singleton object, because there should only be one of them. To utilize this class just derive from it:
Definition at line 51 of file sitkNonCopyable.h.
|
inlineprotected |
Definition at line 54 of file sitkNonCopyable.h.
|
private |
|
private |