SimpleITK  2.0.0rc1.post264
Public Member Functions | Protected Member Functions | List of all members
itk::simple::NonCopyable Class Reference

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

#include <sitkNonCopyable.h>

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

Public Member Functions

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

Protected Member Functions

 NonCopyable ()=default
 

Detailed Description

An inheritable 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 advantage this approach has is the class hierarchy makes it obvious what the intent is, as compared to other approaches.

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

◆ NonCopyable() [1/2]

itk::simple::NonCopyable::NonCopyable ( )
protecteddefault

◆ NonCopyable() [2/2]

itk::simple::NonCopyable::NonCopyable ( const NonCopyable )
delete

Member Function Documentation

◆ operator=()

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

The documentation for this class was generated from the following file:
itk::simple::NonCopyable::NonCopyable
NonCopyable()=default
itk::Singleton
T * Singleton(const char *globalName, std::function< void(void *)> func, std::function< void(void)> deleteFunc)