noncopyable.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // noncopyable.hpp
  3. // ~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_NONCOPYABLE_HPP
  11. #define ASIO_DETAIL_NONCOPYABLE_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/push_options.hpp"
  16. #include "asio/detail/push_options.hpp"
  17. #include <boost/config.hpp>
  18. #include <boost/noncopyable.hpp>
  19. #include <boost/detail/workaround.hpp>
  20. #include "asio/detail/pop_options.hpp"
  21. namespace asio {
  22. namespace detail {
  23. #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
  24. // Redefine the noncopyable class for Borland C++ since that compiler does not
  25. // apply the empty base optimisation unless the base class contains a dummy
  26. // char data member.
  27. class noncopyable
  28. {
  29. protected:
  30. noncopyable() {}
  31. ~noncopyable() {}
  32. private:
  33. noncopyable(const noncopyable&);
  34. const noncopyable& operator=(const noncopyable&);
  35. char dummy_;
  36. };
  37. #else
  38. using boost::noncopyable;
  39. #endif
  40. } // namespace detail
  41. using asio::detail::noncopyable;
  42. } // namespace asio
  43. #include "asio/detail/pop_options.hpp"
  44. #endif // ASIO_DETAIL_NONCOPYABLE_HPP