Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:12

0001 //
0002 // uses_executor.hpp
0003 // ~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 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_USES_EXECUTOR_HPP
0012 #define BOOST_ASIO_USES_EXECUTOR_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 /// A special type, similar to std::nothrow_t, used to disambiguate
0027 /// constructors that accept executor arguments.
0028 /**
0029  * The executor_arg_t struct is an empty structure type used as a unique type
0030  * to disambiguate constructor and function overloading. Specifically, some
0031  * types have constructors with executor_arg_t as the first argument,
0032  * immediately followed by an argument of a type that satisfies the Executor
0033  * type requirements.
0034  */
0035 struct executor_arg_t
0036 {
0037   /// Constructor.
0038   constexpr executor_arg_t() noexcept
0039   {
0040   }
0041 };
0042 
0043 /// A special value, similar to std::nothrow, used to disambiguate constructors
0044 /// that accept executor arguments.
0045 /**
0046  * See boost::asio::executor_arg_t and boost::asio::uses_executor
0047  * for more information.
0048  */
0049 constexpr executor_arg_t executor_arg;
0050 
0051 /// The uses_executor trait detects whether a type T has an associated executor
0052 /// that is convertible from type Executor.
0053 /**
0054  * Meets the BinaryTypeTrait requirements. The Asio library provides a
0055  * definition that is derived from false_type. A program may specialize this
0056  * template to derive from true_type for a user-defined type T that can be
0057  * constructed with an executor, where the first argument of a constructor has
0058  * type executor_arg_t and the second argument is convertible from type
0059  * Executor.
0060  */
0061 template <typename T, typename Executor>
0062 struct uses_executor : false_type {};
0063 
0064 } // namespace asio
0065 } // namespace boost
0066 
0067 #include <boost/asio/detail/pop_options.hpp>
0068 
0069 #endif // BOOST_ASIO_USES_EXECUTOR_HPP