handler_cont_helpers.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // detail/handler_cont_helpers.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2021 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_HANDLER_CONT_HELPERS_HPP
  11. #define BOOST_ASIO_DETAIL_HANDLER_CONT_HELPERS_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/config.hpp>
  16. #include <boost/asio/detail/memory.hpp>
  17. #include <boost/asio/handler_continuation_hook.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. // Calls to asio_handler_is_continuation must be made from a namespace that
  20. // does not contain overloads of this function. This namespace is defined here
  21. // for that purpose.
  22. namespace boost_asio_handler_cont_helpers {
  23. template <typename Context>
  24. inline bool is_continuation(Context& context)
  25. {
  26. #if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
  27. return false;
  28. #else
  29. using boost::asio::asio_handler_is_continuation;
  30. return asio_handler_is_continuation(
  31. boost::asio::detail::addressof(context));
  32. #endif
  33. }
  34. } // namespace boost_asio_handler_cont_helpers
  35. #include <boost/asio/detail/pop_options.hpp>
  36. #endif // BOOST_ASIO_DETAIL_HANDLER_CONT_HELPERS_HPP