diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-27 00:03:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-27 00:03:19 +0000 |
commit | 5de2204fe84a89604a31253a299ab265dee76934 (patch) | |
tree | 142e5dd065732bf4cc8775f69ce0979230836e51 /llvm/include/Support/NonCopyable.h | |
parent | f679703feb9c4702a55f41caec15d5adf997cac9 (diff) | |
download | bcm5719-llvm-5de2204fe84a89604a31253a299ab265dee76934.tar.gz bcm5719-llvm-5de2204fe84a89604a31253a299ab265dee76934.zip |
Create a new #include "Support/..." directory structure to move things
from "llvm/Support/..." that are not llvm dependant.
Move files and fix #includes
llvm-svn: 1400
Diffstat (limited to 'llvm/include/Support/NonCopyable.h')
-rw-r--r-- | llvm/include/Support/NonCopyable.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/include/Support/NonCopyable.h b/llvm/include/Support/NonCopyable.h new file mode 100644 index 00000000000..f4fc26805a4 --- /dev/null +++ b/llvm/include/Support/NonCopyable.h @@ -0,0 +1,37 @@ +//===-- NonCopyable.h - Disable copy ctor and op= in subclasses --*- C++ -*--=// +// +// This file defines the NonCopyable and NonCopyableV classes. These mixin +// classes may be used to mark a class not being copyable. You should derive +// from NonCopyable if you don't want to have a virtual dtor, or NonCopyableV +// if you do want polymorphic behavior in your class. +// +// No library is required when using these functinons. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_NONCOPYABLE_H +#define LLVM_SUPPORT_NONCOPYABLE_H + +class NonCopyable { + // Disable the copy constructor and the assignment operator + // by making them both private: + // + NonCopyable(const NonCopyable &); // DO NOT IMPLEMENT + NonCopyable &operator=(const NonCopyable &); // DO NOT IMPLEMENT +protected: + inline NonCopyable() {} + inline ~NonCopyable() {} +}; + +class NonCopyableV { + // Disable the copy constructor and the assignment operator + // by making them both private: + // + NonCopyableV(const NonCopyableV &); // DO NOT IMPLEMENT + NonCopyableV &operator=(const NonCopyableV &); // DO NOT IMPLEMENT +protected: + inline NonCopyableV() {} + virtual ~NonCopyableV() {} +}; + +#endif |