noncopyable.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // noncopyable.hpp
  3. // ~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2008 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 BOOST_ASIO_DETAIL_NONCOPYABLE_HPP
  11. #define BOOST_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 <boost/asio/detail/push_options.hpp>
  16. #include <boost/asio/detail/push_options.hpp>
  17. #include <boost/config.hpp>
  18. #include <boost/noncopyable.hpp>
  19. #include <boost/detail/workaround.hpp>
  20. #include <boost/asio/detail/pop_options.hpp>
  21. namespace boost {
  22. namespace asio {
  23. namespace detail {
  24. #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
  25. // Redefine the noncopyable class for Borland C++ since that compiler does not
  26. // apply the empty base optimisation unless the base class contains a dummy
  27. // char data member.
  28. class noncopyable
  29. {
  30. protected:
  31. noncopyable() {}
  32. ~noncopyable() {}
  33. private:
  34. noncopyable(const noncopyable&);
  35. const noncopyable& operator=(const noncopyable&);
  36. char dummy_;
  37. };
  38. #else
  39. using boost::noncopyable;
  40. #endif
  41. } // namespace detail
  42. using boost::asio::detail::noncopyable;
  43. } // namespace asio
  44. } // namespace boost
  45. #include <boost/asio/detail/pop_options.hpp>
  46. #endif // BOOST_ASIO_DETAIL_NONCOPYABLE_HPP