Chester
 All Classes Files Functions Variables Macros Pages
dptr_noncopy.h
Go to the documentation of this file.
1 //d-ptr header
2 //
3 // (c) Konrad Rosenbaum, 2010-2011
4 // Copying and distribution of this file, with or without modification,
5 // are permitted in any medium without royalty provided the copyright
6 // notice and this notice are preserved. This file is offered as-is,
7 // without any warranty.
8 
9 #include "dptr_base.h"
10 
11 
12 #ifndef DPTR_NONCOPY_CLASS_0_1_H
13 #define DPTR_NONCOPY_CLASS_0_1_H
14 //hide the namespace
16 namespace Chester_0_1{
18 
23 {
24  public:
28  virtual ~NonCopyDPtr(){}
29  private:
33  NonCopyDPtr& operator=(const NonCopyDPtr&){return *this;}
34 };
35 
36 //hide the namespace
38 };
39 using namespace Chester_0_1;
41 #endif
42 
43 #ifdef DEFINE_NONCOPY_DPTR
44 #undef DEFINE_NONCOPY_DPTR
45 #endif
46 
54 #define DEFINE_NONCOPY_DPTR(Class) \
55  Class::DPrivate::DPrivate(){d=new Class::Private;}\
56  Class::DPrivate::DPrivate(const Class::DPrivate&){}\
57  Class::DPrivate::~DPrivate(){delete d;}\
58  Class::DPrivate& Class::DPrivate::operator=(const Class::DPrivate&)\
59  {return *this;}
NonCopyDPtr & operator=(const NonCopyDPtr &)
hides the assignment operator
Definition: dptr_noncopy.h:33
Base class of non-shared d-pointers.
Definition: dptr_noncopy.h:22
NonCopyDPtr(const NonCopyDPtr &)
hides the copy constructor
Definition: dptr_noncopy.h:31
virtual ~NonCopyDPtr()
deletes a non-shared d-pointer
Definition: dptr_noncopy.h:28
NonCopyDPtr()
instantiates a non-shared d-pointer
Definition: dptr_noncopy.h:26