User Manual, Developers Guide and API Documentation

wns::NonCopyable Class Reference

Prohibits copy construction and copy assignment for a class "A" if you derive "A" from this class. More...

#include <NonCopyable.hpp>

Inheritance diagram for wns::NonCopyable:

Inheritance graph
[legend]

List of all members.

Protected Member Functions

 NonCopyable ()
 Avoid instantiation of NonCopyable object (useless).
virtual ~NonCopyable ()
 Avoid deletion of NonCopyable object (symmetric with c'tor).

Private Member Functions

 NonCopyable (const NonCopyable &)
 Private and not implemented to forbid copy construction.
NonCopyableoperator= (const NonCopyable &)
 Private and not implemented to forbid assignment.


Detailed Description

Author:
Marc Schinnenburg <marc@schinnenburg.com>
This has been taken from the documentation of boost::noncopyable:

Some objects, particularly those which hold complex resources like files or network connections, have no sensible copy semantics. Sometimes there are possible copy semantics, but these would be of very limited usefulness and be very difficult to implement correctly. Sometimes you're implementing a class that doesn't need to be copied just yet and you don't want to take the time to write the appropriate functions. Deriving from NonCopyable will prevent the otherwise implicitly-generated functions (which don't have the proper semantics) from becoming a trap for other programmers.

The traditional way to deal with these is to declare a private copy constructor and copy assignment, and then document why this is done. But deriving from NonCopyable is simpler and clearer, and doesn't require additional documentation.

Definition at line 56 of file NonCopyable.hpp.


Constructor & Destructor Documentation

wns::NonCopyable::NonCopyable (  )  [inline, protected]

Definition at line 62 of file NonCopyable.hpp.

virtual wns::NonCopyable::~NonCopyable (  )  [inline, protected, virtual]

Definition at line 70 of file NonCopyable.hpp.

wns::NonCopyable::NonCopyable ( const NonCopyable  )  [private]


Member Function Documentation

NonCopyable& wns::NonCopyable::operator= ( const NonCopyable  )  [private]


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

Generated on Sat May 26 03:32:51 2012 for openWNS by  doxygen 1.5.5