Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-26 08:25:30

0001 //
0002 // default_completion_token.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_HPP
0012 #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/detail/type_traits.hpp>
0020 
0021 #include <boost/asio/detail/push_options.hpp>
0022 
0023 namespace boost {
0024 namespace asio {
0025 
0026 class deferred_t;
0027 
0028 namespace detail {
0029 
0030 template <typename T, typename = void>
0031 struct default_completion_token_impl
0032 {
0033   typedef deferred_t type;
0034 };
0035 
0036 template <typename T>
0037 struct default_completion_token_impl<T,
0038     void_t<typename T::default_completion_token_type>
0039   >
0040 {
0041   typedef typename T::default_completion_token_type type;
0042 };
0043 
0044 } // namespace detail
0045 
0046 #if defined(GENERATING_DOCUMENTATION)
0047 
0048 /// Traits type used to determine the default completion token type associated
0049 /// with a type (such as an executor).
0050 /**
0051  * A program may specialise this traits type if the @c T template parameter in
0052  * the specialisation is a user-defined type.
0053  *
0054  * Specialisations of this trait may provide a nested typedef @c type, which is
0055  * a default-constructible completion token type.
0056  *
0057  * If not otherwise specialised, the default completion token type is
0058  * boost::asio::deferred_t.
0059  */
0060 template <typename T>
0061 struct default_completion_token
0062 {
0063   /// If @c T has a nested type @c default_completion_token_type,
0064   /// <tt>T::default_completion_token_type</tt>. Otherwise the typedef @c type
0065   /// is boost::asio::deferred_t.
0066   typedef see_below type;
0067 };
0068 #else
0069 template <typename T>
0070 struct default_completion_token
0071   : detail::default_completion_token_impl<T>
0072 {
0073 };
0074 #endif
0075 
0076 template <typename T>
0077 using default_completion_token_t = typename default_completion_token<T>::type;
0078 
0079 #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e) \
0080   = typename ::boost::asio::default_completion_token<e>::type
0081 #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(e) \
0082   = typename ::boost::asio::default_completion_token<e>::type()
0083 
0084 } // namespace asio
0085 } // namespace boost
0086 
0087 #include <boost/asio/detail/pop_options.hpp>
0088 
0089 #include <boost/asio/deferred.hpp>
0090 
0091 #endif // BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_HPP