1 //===-- NonCopyable.h - Disable copy ctor and op= in subclasses --*- C++ -*--=//
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.
8 // No library is required when using these functinons.
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_SUPPORT_NONCOPYABLE_H
13 #define LLVM_SUPPORT_NONCOPYABLE_H
16 // Disable the copy constructor and the assignment operator
17 // by making them both private:
19 NonCopyable(const NonCopyable &); // DO NOT IMPLEMENT
20 NonCopyable &operator=(const NonCopyable &); // DO NOT IMPLEMENT
22 inline NonCopyable() {}
23 inline ~NonCopyable() {}
27 // Disable the copy constructor and the assignment operator
28 // by making them both private:
30 NonCopyableV(const NonCopyableV &); // DO NOT IMPLEMENT
31 NonCopyableV &operator=(const NonCopyableV &); // DO NOT IMPLEMENT
33 inline NonCopyableV() {}
34 virtual ~NonCopyableV() {}