summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/include/asio/execution/mapping.hpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/include/asio/execution/mapping.hpp')
-rw-r--r--3rdparty/asio/include/asio/execution/mapping.hpp594
1 files changed, 240 insertions, 354 deletions
diff --git a/3rdparty/asio/include/asio/execution/mapping.hpp b/3rdparty/asio/include/asio/execution/mapping.hpp
index 33924c81466..4c6e1791869 100644
--- a/3rdparty/asio/include/asio/execution/mapping.hpp
+++ b/3rdparty/asio/include/asio/execution/mapping.hpp
@@ -2,7 +2,7 @@
// execution/mapping.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2024 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)
@@ -18,8 +18,6 @@
#include "asio/detail/config.hpp"
#include "asio/detail/type_traits.hpp"
#include "asio/execution/executor.hpp"
-#include "asio/execution/scheduler.hpp"
-#include "asio/execution/sender.hpp"
#include "asio/is_applicable_property.hpp"
#include "asio/query.hpp"
#include "asio/traits/query_free.hpp"
@@ -40,10 +38,9 @@ namespace execution {
/// of execution agents on to threads of execution.
struct mapping_t
{
- /// The mapping_t property applies to executors, senders, and schedulers.
+ /// The mapping_t property applies to executors.
template <typename T>
- static constexpr bool is_applicable_property_v =
- is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
+ static constexpr bool is_applicable_property_v = is_executor_v<T>;
/// The top-level mapping_t property cannot be required.
static constexpr bool is_requirable = false;
@@ -58,11 +55,9 @@ struct mapping_t
/// threads of execution.
struct thread_t
{
- /// The mapping_t::thread_t property applies to executors, senders, and
- /// schedulers.
+ /// The mapping_t::thread_t property applies to executors.
template <typename T>
- static constexpr bool is_applicable_property_v =
- is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
+ static constexpr bool is_applicable_property_v = is_executor_v<T>;
/// The mapping_t::thread_t property can be required.
static constexpr bool is_requirable = true;
@@ -87,11 +82,9 @@ struct mapping_t
/// new threads of execution.
struct new_thread_t
{
- /// The mapping_t::new_thread_t property applies to executors, senders, and
- /// schedulers.
+ /// The mapping_t::new_thread_t property applies to executors.
template <typename T>
- static constexpr bool is_applicable_property_v =
- is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
+ static constexpr bool is_applicable_property_v = is_executor_v<T>;
/// The mapping_t::new_thread_t property can be required.
static constexpr bool is_requirable = true;
@@ -116,11 +109,9 @@ struct mapping_t
/// implementation-defined.
struct other_t
{
- /// The mapping_t::other_t property applies to executors, senders, and
- /// schedulers.
+ /// The mapping_t::other_t property applies to executors.
template <typename T>
- static constexpr bool is_applicable_property_v =
- is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
+ static constexpr bool is_applicable_property_v = is_executor_v<T>;
/// The mapping_t::other_t property can be required.
static constexpr bool is_requirable = true;
@@ -193,45 +184,33 @@ struct mapping_t
{
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
- ASIO_STATIC_CONSTEXPR(bool,
- 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));
+ static constexpr bool is_applicable_property_v = is_executor<T>::value;
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
- ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
- ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
+ static constexpr bool is_requirable = false;
+ static constexpr bool is_preferable = false;
typedef mapping_t polymorphic_query_result_type;
typedef detail::mapping::thread_t<I> thread_t;
typedef detail::mapping::new_thread_t<I> new_thread_t;
typedef detail::mapping::other_t<I> other_t;
- ASIO_CONSTEXPR mapping_t()
+ constexpr mapping_t()
: value_(-1)
{
}
- ASIO_CONSTEXPR mapping_t(thread_t)
+ constexpr mapping_t(thread_t)
: value_(0)
{
}
- ASIO_CONSTEXPR mapping_t(new_thread_t)
+ constexpr mapping_t(new_thread_t)
: value_(1)
{
}
- ASIO_CONSTEXPR mapping_t(other_t)
+ constexpr mapping_t(other_t)
: value_(2)
{
}
@@ -243,16 +222,14 @@ struct mapping_t
struct type
{
template <typename P>
- auto query(ASIO_MOVE_ARG(P) p) const
+ auto query(P&& p) const
noexcept(
noexcept(
- declval<typename conditional<true, T, P>::type>().query(
- ASIO_MOVE_CAST(P)(p))
+ declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
)
)
-> decltype(
- declval<typename conditional<true, T, P>::type>().query(
- ASIO_MOVE_CAST(P)(p))
+ declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
);
};
#else // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
@@ -267,17 +244,17 @@ struct mapping_t
struct type
{
template <typename P>
- static constexpr auto query(ASIO_MOVE_ARG(P) p)
+ static constexpr auto query(P&& p)
noexcept(
noexcept(
- conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
+ conditional_t<true, T, P>::query(static_cast<P&&>(p))
)
)
-> decltype(
- conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
+ conditional_t<true, T, P>::query(static_cast<P&&>(p))
)
{
- return T::query(ASIO_MOVE_CAST(P)(p));
+ return T::query(static_cast<P&&>(p));
}
};
#else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
@@ -297,88 +274,87 @@ struct mapping_t
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
- static ASIO_CONSTEXPR
+ static constexpr
typename query_static_constexpr_member<T>::result_type
static_query()
- ASIO_NOEXCEPT_IF((
- query_static_constexpr_member<T>::is_noexcept))
+ noexcept(query_static_constexpr_member<T>::is_noexcept)
{
return query_static_constexpr_member<T>::value();
}
template <typename T>
- static ASIO_CONSTEXPR
+ static constexpr
typename traits::static_query<T, thread_t>::result_type
static_query(
- typename enable_if<
+ enable_if_t<
!query_static_constexpr_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!query_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
traits::static_query<T, thread_t>::is_valid
- >::type* = 0) ASIO_NOEXCEPT
+ >* = 0) noexcept
{
return traits::static_query<T, thread_t>::value();
}
template <typename T>
- static ASIO_CONSTEXPR
+ static constexpr
typename traits::static_query<T, new_thread_t>::result_type
static_query(
- typename enable_if<
+ enable_if_t<
!query_static_constexpr_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!query_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!traits::static_query<T, thread_t>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
traits::static_query<T, new_thread_t>::is_valid
- >::type* = 0) ASIO_NOEXCEPT
+ >* = 0) noexcept
{
return traits::static_query<T, new_thread_t>::value();
}
template <typename T>
- static ASIO_CONSTEXPR
+ static constexpr
typename traits::static_query<T, other_t>::result_type
static_query(
- typename enable_if<
+ enable_if_t<
!query_static_constexpr_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!query_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!traits::static_query<T, thread_t>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!traits::static_query<T, new_thread_t>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
traits::static_query<T, other_t>::is_valid
- >::type* = 0) ASIO_NOEXCEPT
+ >* = 0) noexcept
{
return traits::static_query<T, other_t>::value();
}
template <typename E, typename T = decltype(mapping_t::static_query<E>())>
- static ASIO_CONSTEXPR const T static_query_v
+ static constexpr const T static_query_v
= mapping_t::static_query<E>();
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
- friend ASIO_CONSTEXPR bool operator==(
+ friend constexpr bool operator==(
const mapping_t& a, const mapping_t& b)
{
return a.value_ == b.value_;
}
- friend ASIO_CONSTEXPR bool operator!=(
+ friend constexpr bool operator!=(
const mapping_t& a, const mapping_t& b)
{
return a.value_ != b.value_;
@@ -386,22 +362,20 @@ struct mapping_t
struct convertible_from_mapping_t
{
- ASIO_CONSTEXPR convertible_from_mapping_t(mapping_t) {}
+ constexpr convertible_from_mapping_t(mapping_t) {}
};
template <typename Executor>
- friend ASIO_CONSTEXPR mapping_t query(
+ friend constexpr mapping_t query(
const Executor& ex, convertible_from_mapping_t,
- typename enable_if<
+ enable_if_t<
can_query<const Executor&, thread_t>::value
- >::type* = 0)
+ >* = 0)
#if !defined(__clang__) // Clang crashes if noexcept is used here.
#if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
- ASIO_NOEXCEPT_IF((
- is_nothrow_query<const Executor&, mapping_t<>::thread_t>::value))
+ noexcept(is_nothrow_query<const Executor&, mapping_t<>::thread_t>::value)
#else // defined(ASIO_MSVC)
- ASIO_NOEXCEPT_IF((
- is_nothrow_query<const Executor&, thread_t>::value))
+ noexcept(is_nothrow_query<const Executor&, thread_t>::value)
#endif // defined(ASIO_MSVC)
#endif // !defined(__clang__)
{
@@ -409,21 +383,20 @@ struct mapping_t
}
template <typename Executor>
- friend ASIO_CONSTEXPR mapping_t query(
+ friend constexpr mapping_t query(
const Executor& ex, convertible_from_mapping_t,
- typename enable_if<
+ enable_if_t<
!can_query<const Executor&, thread_t>::value
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
can_query<const Executor&, new_thread_t>::value
- >::type* = 0)
+ >* = 0)
#if !defined(__clang__) // Clang crashes if noexcept is used here.
#if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
- ASIO_NOEXCEPT_IF((
- is_nothrow_query<const Executor&, mapping_t<>::new_thread_t>::value))
+ noexcept(
+ is_nothrow_query<const Executor&, mapping_t<>::new_thread_t>::value)
#else // defined(ASIO_MSVC)
- ASIO_NOEXCEPT_IF((
- is_nothrow_query<const Executor&, new_thread_t>::value))
+ noexcept(is_nothrow_query<const Executor&, new_thread_t>::value)
#endif // defined(ASIO_MSVC)
#endif // !defined(__clang__)
{
@@ -431,24 +404,22 @@ struct mapping_t
}
template <typename Executor>
- friend ASIO_CONSTEXPR mapping_t query(
+ friend constexpr mapping_t query(
const Executor& ex, convertible_from_mapping_t,
- typename enable_if<
+ enable_if_t<
!can_query<const Executor&, thread_t>::value
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!can_query<const Executor&, new_thread_t>::value
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
can_query<const Executor&, other_t>::value
- >::type* = 0)
+ >* = 0)
#if !defined(__clang__) // Clang crashes if noexcept is used here.
#if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
- ASIO_NOEXCEPT_IF((
- is_nothrow_query<const Executor&, mapping_t<>::other_t>::value))
+ noexcept(is_nothrow_query<const Executor&, mapping_t<>::other_t>::value)
#else // defined(ASIO_MSVC)
- ASIO_NOEXCEPT_IF((
- is_nothrow_query<const Executor&, other_t>::value))
+ noexcept(is_nothrow_query<const Executor&, other_t>::value)
#endif // defined(ASIO_MSVC)
#endif // !defined(__clang__)
{
@@ -459,10 +430,6 @@ struct mapping_t
ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(new_thread_t, new_thread);
ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(other_t, other);
-#if !defined(ASIO_HAS_CONSTEXPR)
- static const mapping_t instance;
-#endif // !defined(ASIO_HAS_CONSTEXPR)
-
private:
int value_;
};
@@ -474,11 +441,6 @@ const T mapping_t<I>::static_query_v;
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
-#if !defined(ASIO_HAS_CONSTEXPR)
-template <int I>
-const mapping_t<I> mapping_t<I>::instance;
-#endif
-
template <int I>
const typename mapping_t<I>::thread_t mapping_t<I>::thread;
@@ -495,26 +457,14 @@ struct thread_t
{
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
- ASIO_STATIC_CONSTEXPR(bool,
- 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));
+ static constexpr bool is_applicable_property_v = is_executor<T>::value;
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
- ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
- ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
+ static constexpr bool is_requirable = true;
+ static constexpr bool is_preferable = true;
typedef mapping_t<I> polymorphic_query_result_type;
- ASIO_CONSTEXPR thread_t()
+ constexpr thread_t()
{
}
@@ -531,58 +481,75 @@ struct thread_t
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
- static ASIO_CONSTEXPR
+ static constexpr
typename query_static_constexpr_member<T>::result_type
static_query()
- ASIO_NOEXCEPT_IF((
- query_static_constexpr_member<T>::is_noexcept))
+ noexcept(query_static_constexpr_member<T>::is_noexcept)
{
return query_static_constexpr_member<T>::value();
}
template <typename T>
- static ASIO_CONSTEXPR thread_t static_query(
- typename enable_if<
+ static constexpr thread_t static_query(
+ enable_if_t<
!query_static_constexpr_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!query_member<T>::is_valid
- >::type* = 0,
- typename enable_if<
+ >* = 0,
+ enable_if_t<
!traits::query_free<T, thread_t>::is_valid
- >::type* = 0,
- typename enable_if<
- !can_query<T, new_thread_t<I> >::value
- >::type* = 0,
- typename enable_if<
- !can_query<T, other_t<I> >::value
- >::type* = 0) ASIO_NOEXCEPT
+ >* = 0,
+ enable_if_t<
+ !can_query<T, new_thread_t<I>>::value
+ >* = 0,
+ enable_if_t<
+ !can_query<T, other_t<I>>::value
+ >* = 0) noexcept
{
return thread_t();
}
template <typename E, typename T = decltype(thread_t::static_query<E>())>
- static ASIO_CONSTEXPR const T static_query_v
+ static constexpr const T static_query_v
= thread_t::static_query<E>();
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
- static ASIO_CONSTEXPR mapping_t<I> value()
+ static constexpr mapping_t<I> value()
{
return thread_t();
}
- friend ASIO_CONSTEXPR bool operator==(
- const thread_t&, const thread_t&)
+ friend constexpr bool operator==(const thread_t&, const thread_t&)
{
return true;
}
- friend ASIO_CONSTEXPR bool operator!=(
- const thread_t&, const thread_t&)
+ friend constexpr bool operator!=(const thread_t&, const thread_t&)
+ {
+ return false;
+ }
+
+ friend constexpr bool operator==(const thread_t&, const new_thread_t<I>&)
{
return false;
}
+
+ friend constexpr bool operator!=(const thread_t&, const new_thread_t<I>&)
+ {
+ return true;
+ }
+
+ friend constexpr bool operator==(const thread_t&, const other_t<I>&)
+ {
+ return false;
+ }
+
+ friend constexpr bool operator!=(const thread_t&, const other_t<I>&)
+ {
+ return true;
+ }
};
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
@@ -597,26 +564,14 @@ struct new_thread_t
{
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
- ASIO_STATIC_CONSTEXPR(bool,
- 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));
+ static constexpr bool is_applicable_property_v = is_executor<T>::value;
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
- ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
- ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
+ static constexpr bool is_requirable = true;
+ static constexpr bool is_preferable = true;
typedef mapping_t<I> polymorphic_query_result_type;
- ASIO_CONSTEXPR new_thread_t()
+ constexpr new_thread_t()
{
}
@@ -633,37 +588,52 @@ struct new_thread_t
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
- static ASIO_CONSTEXPR
- typename query_static_constexpr_member<T>::result_type
+ static constexpr typename query_static_constexpr_member<T>::result_type
static_query()
- ASIO_NOEXCEPT_IF((
- query_static_constexpr_member<T>::is_noexcept))
+ noexcept(query_static_constexpr_member<T>::is_noexcept)
{
return query_static_constexpr_member<T>::value();
}
template <typename E, typename T = decltype(new_thread_t::static_query<E>())>
- static ASIO_CONSTEXPR const T static_query_v
- = new_thread_t::static_query<E>();
+ static constexpr const T static_query_v = new_thread_t::static_query<E>();
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
- static ASIO_CONSTEXPR mapping_t<I> value()
+ static constexpr mapping_t<I> value()
{
return new_thread_t();
}
- friend ASIO_CONSTEXPR bool operator==(
- const new_thread_t&, const new_thread_t&)
+ friend constexpr bool operator==(const new_thread_t&, const new_thread_t&)
+ {
+ return true;
+ }
+
+ friend constexpr bool operator!=(const new_thread_t&, const new_thread_t&)
+ {
+ return false;
+ }
+
+ friend constexpr bool operator==(const new_thread_t&, const thread_t<I>&)
+ {
+ return false;
+ }
+
+ friend constexpr bool operator!=(const new_thread_t&, const thread_t<I>&)
{
return true;
}
- friend ASIO_CONSTEXPR bool operator!=(
- const new_thread_t&, const new_thread_t&)
+ friend constexpr bool operator==(const new_thread_t&, const other_t<I>&)
{
return false;
}
+
+ friend constexpr bool operator!=(const new_thread_t&, const other_t<I>&)
+ {
+ return true;
+ }
};
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
@@ -678,26 +648,14 @@ struct other_t
{
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
template <typename T>
- ASIO_STATIC_CONSTEXPR(bool,
- 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));
+ static constexpr bool is_applicable_property_v = is_executor<T>::value;
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
- ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
- ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
+ static constexpr bool is_requirable = true;
+ static constexpr bool is_preferable = true;
typedef mapping_t<I> polymorphic_query_result_type;
- ASIO_CONSTEXPR other_t()
+ constexpr other_t()
{
}
@@ -714,37 +672,53 @@ struct other_t
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
template <typename T>
- static ASIO_CONSTEXPR
+ static constexpr
typename query_static_constexpr_member<T>::result_type
static_query()
- ASIO_NOEXCEPT_IF((
- query_static_constexpr_member<T>::is_noexcept))
+ noexcept(query_static_constexpr_member<T>::is_noexcept)
{
return query_static_constexpr_member<T>::value();
}
template <typename E, typename T = decltype(other_t::static_query<E>())>
- static ASIO_CONSTEXPR const T static_query_v
- = other_t::static_query<E>();
+ static constexpr const T static_query_v = other_t::static_query<E>();
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
- static ASIO_CONSTEXPR mapping_t<I> value()
+ static constexpr mapping_t<I> value()
{
return other_t();
}
- friend ASIO_CONSTEXPR bool operator==(
- const other_t&, const other_t&)
+ friend constexpr bool operator==(const other_t&, const other_t&)
+ {
+ return true;
+ }
+
+ friend constexpr bool operator!=(const other_t&, const other_t&)
+ {
+ return false;
+ }
+
+ friend constexpr bool operator==(const other_t&, const thread_t<I>&)
+ {
+ return false;
+ }
+
+ friend constexpr bool operator!=(const other_t&, const thread_t<I>&)
{
return true;
}
- friend ASIO_CONSTEXPR bool operator!=(
- const other_t&, const other_t&)
+ friend constexpr bool operator==(const other_t&, const new_thread_t<I>&)
{
return false;
}
+
+ friend constexpr bool operator!=(const other_t&, const new_thread_t<I>&)
+ {
+ return true;
+ }
};
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
@@ -759,11 +733,7 @@ const T other_t<I>::static_query_v;
typedef detail::mapping_t<> mapping_t;
-#if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
constexpr mapping_t mapping;
-#else // defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
-namespace { static const mapping_t& mapping = mapping_t::instance; }
-#endif
} // namespace execution
@@ -771,69 +741,25 @@ namespace { static const mapping_t& mapping = mapping_t::instance; }
template <typename T>
struct is_applicable_property<T, execution::mapping_t>
- : integral_constant<bool,
- execution::is_executor<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>
+ : integral_constant<bool, execution::is_executor<T>::value>
{
};
template <typename T>
struct is_applicable_property<T, execution::mapping_t::thread_t>
- : integral_constant<bool,
- execution::is_executor<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>
+ : integral_constant<bool, execution::is_executor<T>::value>
{
};
template <typename T>
struct is_applicable_property<T, execution::mapping_t::new_thread_t>
- : integral_constant<bool,
- execution::is_executor<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>
+ : integral_constant<bool, execution::is_executor<T>::value>
{
};
template <typename T>
struct is_applicable_property<T, execution::mapping_t::other_t>
- : integral_constant<bool,
- execution::is_executor<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>
+ : integral_constant<bool, execution::is_executor<T>::value>
{
};
@@ -845,42 +771,42 @@ namespace traits {
template <typename T>
struct query_free_default<T, execution::mapping_t,
- typename enable_if<
+ enable_if_t<
can_query<T, execution::mapping_t::thread_t>::value
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
- (is_nothrow_query<T, execution::mapping_t::thread_t>::value));
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept =
+ is_nothrow_query<T, execution::mapping_t::thread_t>::value;
typedef execution::mapping_t result_type;
};
template <typename T>
struct query_free_default<T, execution::mapping_t,
- typename enable_if<
+ enable_if_t<
!can_query<T, execution::mapping_t::thread_t>::value
&& can_query<T, execution::mapping_t::new_thread_t>::value
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
- (is_nothrow_query<T, execution::mapping_t::new_thread_t>::value));
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept =
+ is_nothrow_query<T, execution::mapping_t::new_thread_t>::value;
typedef execution::mapping_t result_type;
};
template <typename T>
struct query_free_default<T, execution::mapping_t,
- typename enable_if<
+ enable_if_t<
!can_query<T, execution::mapping_t::thread_t>::value
&& !can_query<T, execution::mapping_t::new_thread_t>::value
&& can_query<T, execution::mapping_t::other_t>::value
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
- (is_nothrow_query<T, execution::mapping_t::other_t>::value));
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept =
+ is_nothrow_query<T, execution::mapping_t::other_t>::value;
typedef execution::mapping_t result_type;
};
@@ -892,18 +818,18 @@ struct query_free_default<T, execution::mapping_t,
template <typename T>
struct static_query<T, execution::mapping_t,
- typename enable_if<
+ enable_if_t<
execution::detail::mapping_t<0>::
query_static_constexpr_member<T>::is_valid
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef typename execution::detail::mapping_t<0>::
query_static_constexpr_member<T>::result_type result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return execution::detail::mapping_t<0>::
query_static_constexpr_member<T>::value();
@@ -912,21 +838,21 @@ struct static_query<T, execution::mapping_t,
template <typename T>
struct static_query<T, execution::mapping_t,
- typename enable_if<
+ enable_if_t<
!execution::detail::mapping_t<0>::
query_static_constexpr_member<T>::is_valid
&& !execution::detail::mapping_t<0>::
query_member<T>::is_valid
&& traits::static_query<T, execution::mapping_t::thread_t>::is_valid
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef typename traits::static_query<T,
execution::mapping_t::thread_t>::result_type result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return traits::static_query<T, execution::mapping_t::thread_t>::value();
}
@@ -934,22 +860,22 @@ struct static_query<T, execution::mapping_t,
template <typename T>
struct static_query<T, execution::mapping_t,
- typename enable_if<
+ enable_if_t<
!execution::detail::mapping_t<0>::
query_static_constexpr_member<T>::is_valid
&& !execution::detail::mapping_t<0>::
query_member<T>::is_valid
&& !traits::static_query<T, execution::mapping_t::thread_t>::is_valid
&& traits::static_query<T, execution::mapping_t::new_thread_t>::is_valid
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef typename traits::static_query<T,
execution::mapping_t::new_thread_t>::result_type result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return traits::static_query<T, execution::mapping_t::new_thread_t>::value();
}
@@ -957,7 +883,7 @@ struct static_query<T, execution::mapping_t,
template <typename T>
struct static_query<T, execution::mapping_t,
- typename enable_if<
+ enable_if_t<
!execution::detail::mapping_t<0>::
query_static_constexpr_member<T>::is_valid
&& !execution::detail::mapping_t<0>::
@@ -965,15 +891,15 @@ struct static_query<T, execution::mapping_t,
&& !traits::static_query<T, execution::mapping_t::thread_t>::is_valid
&& !traits::static_query<T, execution::mapping_t::new_thread_t>::is_valid
&& traits::static_query<T, execution::mapping_t::other_t>::is_valid
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef typename traits::static_query<T,
execution::mapping_t::other_t>::result_type result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return traits::static_query<T, execution::mapping_t::other_t>::value();
}
@@ -981,18 +907,18 @@ struct static_query<T, execution::mapping_t,
template <typename T>
struct static_query<T, execution::mapping_t::thread_t,
- typename enable_if<
+ enable_if_t<
execution::detail::mapping::thread_t<0>::
query_static_constexpr_member<T>::is_valid
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef typename execution::detail::mapping::thread_t<0>::
query_static_constexpr_member<T>::result_type result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return execution::detail::mapping::thread_t<0>::
query_static_constexpr_member<T>::value();
@@ -1001,7 +927,7 @@ struct static_query<T, execution::mapping_t::thread_t,
template <typename T>
struct static_query<T, execution::mapping_t::thread_t,
- typename enable_if<
+ enable_if_t<
!execution::detail::mapping::thread_t<0>::
query_static_constexpr_member<T>::is_valid
&& !execution::detail::mapping::thread_t<0>::
@@ -1009,14 +935,14 @@ struct static_query<T, execution::mapping_t::thread_t,
&& !traits::query_free<T, execution::mapping_t::thread_t>::is_valid
&& !can_query<T, execution::mapping_t::new_thread_t>::value
&& !can_query<T, execution::mapping_t::other_t>::value
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef execution::mapping_t::thread_t result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return result_type();
}
@@ -1024,18 +950,18 @@ struct static_query<T, execution::mapping_t::thread_t,
template <typename T>
struct static_query<T, execution::mapping_t::new_thread_t,
- typename enable_if<
+ enable_if_t<
execution::detail::mapping::new_thread_t<0>::
query_static_constexpr_member<T>::is_valid
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef typename execution::detail::mapping::new_thread_t<0>::
query_static_constexpr_member<T>::result_type result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return execution::detail::mapping::new_thread_t<0>::
query_static_constexpr_member<T>::value();
@@ -1044,18 +970,18 @@ struct static_query<T, execution::mapping_t::new_thread_t,
template <typename T>
struct static_query<T, execution::mapping_t::other_t,
- typename enable_if<
+ enable_if_t<
execution::detail::mapping::other_t<0>::
query_static_constexpr_member<T>::is_valid
- >::type>
+ >>
{
- ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
- ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
+ static constexpr bool is_valid = true;
+ static constexpr bool is_noexcept = true;
typedef typename execution::detail::mapping::other_t<0>::
query_static_constexpr_member<T>::result_type result_type;
- static ASIO_CONSTEXPR result_type value()
+ static constexpr result_type value()
{
return execution::detail::mapping::other_t<0>::
query_static_constexpr_member<T>::value();
@@ -1065,46 +991,6 @@ struct static_query<T, execution::mapping_t::other_t,
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
// || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
-#if !defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
-
-template <typename T>
-struct static_require<T, execution::mapping_t::thread_t,
- typename enable_if<
- static_query<T, execution::mapping_t::thread_t>::is_valid
- >::type>
-{
- ASIO_STATIC_CONSTEXPR(bool, is_valid =
- (is_same<typename static_query<T,
- execution::mapping_t::thread_t>::result_type,
- execution::mapping_t::thread_t>::value));
-};
-
-template <typename T>
-struct static_require<T, execution::mapping_t::new_thread_t,
- typename enable_if<
- static_query<T, execution::mapping_t::new_thread_t>::is_valid
- >::type>
-{
- ASIO_STATIC_CONSTEXPR(bool, is_valid =
- (is_same<typename static_query<T,
- execution::mapping_t::new_thread_t>::result_type,
- execution::mapping_t::new_thread_t>::value));
-};
-
-template <typename T>
-struct static_require<T, execution::mapping_t::other_t,
- typename enable_if<
- static_query<T, execution::mapping_t::other_t>::is_valid
- >::type>
-{
- ASIO_STATIC_CONSTEXPR(bool, is_valid =
- (is_same<typename static_query<T,
- execution::mapping_t::other_t>::result_type,
- execution::mapping_t::other_t>::value));
-};
-
-#endif // !defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
-
} // namespace traits
#endif // defined(GENERATING_DOCUMENTATION)