// execution/allocator.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
BOOST_ASIO_STATIC_CONSTEXPR(bool,
- is_applicable_property_v = is_executor<T>::value
- || is_sender<T>::value || is_scheduler<T>::value);
+ is_applicable_property_v = (
+ is_executor<T>::value
+ || conditional<
+ is_executor<T>::value,
+ false_type,
+ is_sender<T>
+ >::type::value
+ || conditional<
+ is_executor<T>::value,
+ false_type,
+ is_scheduler<T>
+ >::type::value));
#endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
+ 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(BOOST_ASIO_MOVE_ARG(P) p)
+ noexcept(
+ noexcept(
+ conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
+ )
+ )
+ -> decltype(
+ conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
+ )
+ {
+ return T::query(BOOST_ASIO_MOVE_CAST(P)(p));
+ }
+ };
+#else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
+ typedef T type;
+#endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
+ };
+
+ template <typename T>
+ struct query_static_constexpr_member :
+ traits::query_static_constexpr_member<
+ typename static_proxy<T>::type, allocator_t> {};
+
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
static BOOST_ASIO_CONSTEXPR
- typename traits::query_static_constexpr_member<T, allocator_t>::result_type
+ typename query_static_constexpr_member<T>::result_type
static_query()
BOOST_ASIO_NOEXCEPT_IF((
- traits::query_static_constexpr_member<T, allocator_t>::is_noexcept))
+ query_static_constexpr_member<T>::is_noexcept))
{
- return traits::query_static_constexpr_member<T, allocator_t>::value();
+ return query_static_constexpr_member<T>::value();
}
template <typename E, typename T = decltype(allocator_t::static_query<E>())>
#if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
BOOST_ASIO_STATIC_CONSTEXPR(bool,
- is_applicable_property_v = is_executor<T>::value
- || is_sender<T>::value || is_scheduler<T>::value);
+ is_applicable_property_v = (
+ is_executor<T>::value
+ || conditional<
+ is_executor<T>::value,
+ false_type,
+ is_sender<T>
+ >::type::value
+ || conditional<
+ is_executor<T>::value,
+ false_type,
+ is_scheduler<T>
+ >::type::value));
#endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
{
}
+ 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(BOOST_ASIO_MOVE_ARG(P) p)
+ noexcept(
+ noexcept(
+ conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
+ )
+ )
+ -> decltype(
+ conditional<true, T, P>::type::query(BOOST_ASIO_MOVE_CAST(P)(p))
+ )
+ {
+ return T::query(BOOST_ASIO_MOVE_CAST(P)(p));
+ }
+ };
+#else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
+ typedef T type;
+#endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
+ };
+
+ template <typename T>
+ struct query_static_constexpr_member :
+ traits::query_static_constexpr_member<
+ typename static_proxy<T>::type, allocator_t> {};
+
#if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
static BOOST_ASIO_CONSTEXPR
- typename traits::query_static_constexpr_member<T, allocator_t>::result_type
+ typename query_static_constexpr_member<T>::result_type
static_query()
BOOST_ASIO_NOEXCEPT_IF((
- traits::query_static_constexpr_member<T, allocator_t>::is_noexcept))
+ query_static_constexpr_member<T>::is_noexcept))
{
- return traits::query_static_constexpr_member<T, allocator_t>::value();
+ return query_static_constexpr_member<T>::value();
}
template <typename E, typename T = decltype(allocator_t::static_query<E>())>
struct is_applicable_property<T, execution::allocator_t<ProtoAllocator> >
: integral_constant<bool,
execution::is_executor<T>::value
- || execution::is_sender<T>::value
- || execution::is_scheduler<T>::value>
+ || conditional<
+ execution::is_executor<T>::value,
+ false_type,
+ execution::is_sender<T>
+ >::type::value
+ || conditional<
+ execution::is_executor<T>::value,
+ false_type,
+ execution::is_scheduler<T>
+ >::type::value>
{
};
template <typename T, typename ProtoAllocator>
struct static_query<T, execution::allocator_t<ProtoAllocator>,
typename enable_if<
- traits::query_static_constexpr_member<T,
- execution::allocator_t<ProtoAllocator> >::is_valid
+ execution::allocator_t<ProtoAllocator>::template
+ query_static_constexpr_member<T>::is_valid
>::type>
{
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
- typedef typename traits::query_static_constexpr_member<T,
- execution::allocator_t<ProtoAllocator> >::result_type result_type;
+ typedef typename execution::allocator_t<ProtoAllocator>::template
+ query_static_constexpr_member<T>::result_type result_type;
static BOOST_ASIO_CONSTEXPR result_type value()
{
- return traits::query_static_constexpr_member<T,
- execution::allocator_t<ProtoAllocator> >::value();
+ return execution::allocator_t<ProtoAllocator>::template
+ query_static_constexpr_member<T>::value();
}
};