5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_USES_EXECUTOR_HPP
12 #define BOOST_ASIO_USES_EXECUTOR_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/detail/type_traits.hpp>
21 #include <boost/asio/detail/push_options.hpp>
26 /// A special type, similar to std::nothrow_t, used to disambiguate
27 /// constructors that accept executor arguments.
29 * The executor_arg_t struct is an empty structure type used as a unique type
30 * to disambiguate constructor and function overloading. Specifically, some
31 * types have constructors with executor_arg_t as the first argument,
32 * immediately followed by an argument of a type that satisfies the Executor
38 BOOST_ASIO_CONSTEXPR executor_arg_t() BOOST_ASIO_NOEXCEPT
43 /// A special value, similar to std::nothrow, used to disambiguate constructors
44 /// that accept executor arguments.
46 * See boost::asio::executor_arg_t and boost::asio::uses_executor
47 * for more information.
49 #if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
50 constexpr executor_arg_t executor_arg;
51 #elif defined(BOOST_ASIO_MSVC)
52 __declspec(selectany) executor_arg_t executor_arg;
55 /// The uses_executor trait detects whether a type T has an associated executor
56 /// that is convertible from type Executor.
58 * Meets the BinaryTypeTrait requirements. The Asio library provides a
59 * definition that is derived from false_type. A program may specialize this
60 * template to derive from true_type for a user-defined type T that can be
61 * constructed with an executor, where the first argument of a constructor has
62 * type executor_arg_t and the second argument is convertible from type
65 template <typename T, typename Executor>
66 struct uses_executor : false_type {};
71 #include <boost/asio/detail/pop_options.hpp>
73 #endif // BOOST_ASIO_USES_EXECUTOR_HPP