From 7e7d14d9d226e77457fb6cf61dd82339be8b74db Mon Sep 17 00:00:00 2001 From: Sven Suursoho Date: Wed, 21 May 2008 13:08:12 +0300 Subject: [PATCH] Idiom class to denote noncopyable inherited class --- sol/noncopyable.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sol/noncopyable.hpp diff --git a/sol/noncopyable.hpp b/sol/noncopyable.hpp new file mode 100644 index 0000000..801eb82 --- /dev/null +++ b/sol/noncopyable.hpp @@ -0,0 +1,38 @@ +#if !defined(sol_noncopyable_hpp_included) +#define sol_noncopyable_hpp_included +/// \addtogroup sol +/// \{ + + +/** + * \file sol/noncopyable.hpp + * \brief Convenience base class providing copy protection for inherited classes + * \author Sven Suursoho + */ + + +namespace sol +{ + + +/// Classes inherited from sol::noncopyable can't be copied +class noncopyable +{ +protected: + + noncopyable () {} + ~noncopyable () {} + + +private: + + noncopyable (noncopyable const &); + noncopyable &operator= (noncopyable const &); +}; + + +} // namespace sol + + +/// \} +#endif // sol_noncopyable_hpp_included -- 2.11.4.GIT