noncopyable.hpp 1014 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Boost noncopyable.hpp header file --------------------------------------//
  2. // (C) Copyright Beman Dawes 1999-2003. Distributed under the Boost
  3. // Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/utility for documentation.
  6. #ifndef BOOST_NONCOPYABLE_HPP_INCLUDED
  7. #define BOOST_NONCOPYABLE_HPP_INCLUDED
  8. namespace boost {
  9. // Private copy constructor and copy assignment ensure classes derived from
  10. // class noncopyable cannot be copied.
  11. // Contributed by Dave Abrahams
  12. namespace noncopyable_ // protection from unintended ADL
  13. {
  14. class noncopyable
  15. {
  16. protected:
  17. noncopyable() {}
  18. ~noncopyable() {}
  19. private: // emphasize the following members are private
  20. noncopyable( const noncopyable& );
  21. const noncopyable& operator=( const noncopyable& );
  22. };
  23. }
  24. typedef noncopyable_::noncopyable noncopyable;
  25. } // namespace boost
  26. #endif // BOOST_NONCOPYABLE_HPP_INCLUDED