handler_type.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // handler_type.hpp
  3. // ~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 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_HANDLER_TYPE_HPP
  11. #define BOOST_ASIO_HANDLER_TYPE_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/type_traits.hpp>
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. /// (Deprecated: Use two-parameter version of async_result.) Default handler
  21. /// type traits provided for all completion token types.
  22. /**
  23. * The handler_type traits class is used for determining the concrete handler
  24. * type to be used for an asynchronous operation. It allows the handler type to
  25. * be determined at the point where the specific completion handler signature
  26. * is known.
  27. *
  28. * This template may be specialised for user-defined completion token types.
  29. */
  30. template <typename CompletionToken, typename Signature, typename = void>
  31. struct handler_type
  32. {
  33. /// The handler type for the specific signature.
  34. typedef typename conditional<
  35. is_same<CompletionToken, typename decay<CompletionToken>::type>::value,
  36. decay<CompletionToken>,
  37. handler_type<typename decay<CompletionToken>::type, Signature>
  38. >::type::type type;
  39. };
  40. } // namespace asio
  41. } // namespace boost
  42. #include <boost/asio/detail/pop_options.hpp>
  43. #endif // BOOST_ASIO_HANDLER_TYPE_HPP