NonCopyable.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _FBASICS_NONCOPYABLE_H_
  2. #define _FBASICS_NONCOPYABLE_H_
  3. #include <memory>
  4. // Note: this file is taken from the C++ Boost library (with minor adaptations).
  5. /**
  6. * The namespace of NICE.
  7. */
  8. namespace NICE {
  9. // protection from unintended ADL
  10. namespace noncopyable_ {
  11. /**
  12. * Private copy constructor and copy assignment ensure classes derived from
  13. * class NonCopyable cannot be copied.
  14. *
  15. * @note
  16. * Contributed by Dave Abrahams
  17. *
  18. * (C) Copyright Beman Dawes 1999-2003. Distributed under the Boost
  19. * Software License, Version 1.0. (See accompanying file
  20. * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  21. *
  22. * See http://www.boost.org/libs/utility for documentation.
  23. */
  24. class NonCopyable {
  25. protected:
  26. NonCopyable() {}
  27. ~NonCopyable() {}
  28. private: // emphasize the following members are private
  29. NonCopyable( const NonCopyable& );
  30. const NonCopyable& operator=( const NonCopyable& );
  31. };
  32. } // namespace noncopyable_
  33. typedef noncopyable_::NonCopyable NonCopyable;
  34. } // namespace
  35. #endif // _FBASICS_NONCOPYABLE_H_