f13b7ce9da83424b5826b64835fe8c1bf15c7be9
[oota-llvm.git] / include / Support / NonCopyable.h
1 //===-- NonCopyable.h - Disable copy ctor and op= in subclasses --*- C++ -*--=//
2 //
3 // This file defines the NonCopyable and NonCopyableV classes.  These mixin
4 // classes may be used to mark a class not being copyable.  You should derive
5 // from NonCopyable if you don't want to have a virtual dtor, or NonCopyableV
6 // if you do want polymorphic behavior in your class.
7 //
8 // No library is required when using these functinons.
9 //
10 //===----------------------------------------------------------------------===//
11
12 #ifndef SUPPORT_NONCOPYABLE_H
13 #define SUPPORT_NONCOPYABLE_H
14
15 class NonCopyable {
16   // Disable the copy constructor and the assignment operator
17   // by making them both private:
18   // 
19   NonCopyable(const NonCopyable &);            // DO NOT IMPLEMENT
20   NonCopyable &operator=(const NonCopyable &); // DO NOT IMPLEMENT
21 protected:
22   inline NonCopyable() {}
23   inline ~NonCopyable() {}
24 };
25
26 #endif