#ifndef BOOST_ASIO_EXECUTION_CONTEXT2_HPP
#define BOOST_ASIO_EXECUTION_CONTEXT2_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif
#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/execution/executor.hpp>
#include <boost/asio/is_applicable_property.hpp>
#include <boost/asio/traits/query_static_constexpr_member.hpp>
#include <boost/asio/traits/static_query.hpp>
#if defined(BOOST_ASIO_HAS_STD_ANY)
# include <any>
#endif
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
#if defined(GENERATING_DOCUMENTATION)
namespace execution {
struct context_t
{
template <typename T>
static constexpr bool is_applicable_property_v = is_executor_v<T>;
static constexpr bool is_requirable = false;
static constexpr bool is_preferable = false;
typedef std::any polymorphic_query_result_type;
};
constexpr context_t context;
}
#else
namespace execution {
namespace detail {
template <int I = 0>
struct context_t
{
#if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
static constexpr bool is_applicable_property_v = is_executor<T>::value;
#endif
static constexpr bool is_requirable = false;
static constexpr bool is_preferable = false;
#if defined(BOOST_ASIO_HAS_STD_ANY)
typedef std::any polymorphic_query_result_type;
#endif
constexpr context_t()
{
}
template <typename T>
struct static_proxy
{
#if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
struct type
{
template <typename P>
static constexpr auto query(P&& p)
noexcept(
noexcept(
conditional_t<true, T, P>::query(static_cast<P&&>(p))
)
)
-> decltype(
conditional_t<true, T, P>::query(static_cast<P&&>(p))
)
{
return T::query(static_cast<P&&>(p));
}
};
#else
typedef T type;
#endif };
template <typename T>
struct query_static_constexpr_member :
traits::query_static_constexpr_member<
typename static_proxy<T>::type, context_t> {};
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
static constexpr typename query_static_constexpr_member<T>::result_type
static_query()
noexcept(query_static_constexpr_member<T>::is_noexcept)
{
return query_static_constexpr_member<T>::value();
}
template <typename E, typename T = decltype(context_t::static_query<E>())>
static constexpr const T static_query_v = context_t::static_query<E>();
#endif };
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <int I> template <typename E, typename T>
const T context_t<I>::static_query_v;
#endif
}
typedef detail::context_t<> context_t;
BOOST_ASIO_INLINE_VARIABLE constexpr context_t context;
}
#if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
struct is_applicable_property<T, execution::context_t>
: integral_constant<bool, execution::is_executor<T>::value>
{
};
#endif
namespace traits {
#if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|| !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
struct static_query<T, execution::context_t,
enable_if_t<
execution::detail::context_t<0>::
query_static_constexpr_member<T>::is_valid
>>
{
static constexpr bool is_valid = true;
static constexpr bool is_noexcept = true;
typedef typename execution::detail::context_t<0>::
query_static_constexpr_member<T>::result_type result_type;
static constexpr result_type value()
{
return execution::detail::context_t<0>::
query_static_constexpr_member<T>::value();
}
};
#endif
}
#endif
} }
#include <boost/asio/detail/pop_options.hpp>
#endif