SimpleITK  1.0.1
Protected Member Functions | Private Member Functions | List of all members
itk::simple::NonCopyable Class Reference

An inheratable class to disable copying of a class. More...

#include <sitkNonCopyable.h>

+ Inheritance diagram for itk::simple::NonCopyable:

Protected Member Functions

 NonCopyable ()
 

Private Member Functions

 NonCopyable (const NonCopyable &)
 
NonCopyableoperator= (const NonCopyable &)
 

Detailed Description

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:

class Singleton
: protected NonCopyable {...};

Definition at line 51 of file sitkNonCopyable.h.

Constructor & Destructor Documentation

itk::simple::NonCopyable::NonCopyable ( )
inlineprotected

Definition at line 54 of file sitkNonCopyable.h.

itk::simple::NonCopyable::NonCopyable ( const NonCopyable )
private

Member Function Documentation

NonCopyable& itk::simple::NonCopyable::operator= ( const NonCopyable )
private

The documentation for this class was generated from the following file: