NonCopyable Class Reference

#include <Pt/NonCopyable.h>

Protects derived classes from being copied. More...

Inherited by AtomicRefCounted [private], Deserializer [private], Authenticator [private], Authorization [private], Authorizer [private], Client [private], MessageHeader [private], Server [private], Service [private], Servlet [private], MemoryPool, PageAllocator [protected], PoolAllocator [protected], RefCounted [private], Client [private], RemoteArgument< A > [private], RemoteCall [private], Responder [private], Result< R > [private], ServiceDefinition [private], ServiceDefinition [private], Signal< const Pt::Event & > [protected], Singleton< T >, Formatter [private], Operation [private], Type [private], Certificate [private], Context, IOStream [private], Clock [private], Condition [private], EventSink [private], EventSource [private], LogChannel [protected], Logger [protected], LogMessage [protected], LogRecord [protected], LogTarget [protected], Mutex [private], MutexLock [private], Pipe, Process [private], ReadLock [private], ReadWriteMutex [private], RecursiveLock [private], RecursiveMutex [private], Selectable [protected], Semaphore [private], SpinLock [private], SpinMutex [private], Thread [protected], WriteLock [private], Reporter [protected], Test [protected], AttributeList [private], DocType [private], DocTypeDefinition [private], DocTypeValidator [private], EndDocType [private], EndElement [private], EntityReference [private], InputSource [private], StartElement [private], XmlFormatter [private], XmlReader [private], and Formatter [private].

Public Member Functions

 NonCopyable ()
 Default constructor.
 
 ~NonCopyable ()
 Destructor.
 

Detailed Description

The NonCopyable class has a private copy constructor and assignment operator, therefore derived classes cannot be copied. This class is meant to be used as a base class as shown in the code example below.

class MyClass : private NonCopyable
{
// ...
};

Trying to copy a NonCopyable object will cause a compile-time error.