Initial commit
This commit is contained in:
337
extern/asio-1.18.2/include/asio/execution/allocator.hpp
vendored
Normal file
337
extern/asio-1.18.2/include/asio/execution/allocator.hpp
vendored
Normal file
@@ -0,0 +1,337 @@
|
||||
//
|
||||
// execution/allocator.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_ALLOCATOR_HPP
|
||||
#define ASIO_EXECUTION_ALLOCATOR_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#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/traits/query_static_constexpr_member.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
/// A property to describe which allocator an executor will use to allocate the
|
||||
/// memory required to store a submitted function object.
|
||||
template <typename ProtoAllocator>
|
||||
struct allocator_t
|
||||
{
|
||||
/// The allocator_t property applies to executors, senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The allocator_t property can be required.
|
||||
static constexpr bool is_requirable = true;
|
||||
|
||||
/// The allocator_t property can be preferred.
|
||||
static constexpr bool is_preferable = true;
|
||||
|
||||
/// Default constructor.
|
||||
constexpr allocator_t();
|
||||
|
||||
/// Obtain the allocator stored in the allocator_t property object.
|
||||
/**
|
||||
* Present only if @c ProtoAllocator is non-void.
|
||||
*/
|
||||
constexpr ProtoAllocator value() const;
|
||||
|
||||
/// Create an allocator_t object with a different allocator.
|
||||
/**
|
||||
* Present only if @c ProtoAllocator is void.
|
||||
*/
|
||||
template <typename OtherAllocator>
|
||||
allocator_t<OtherAllocator operator()(const OtherAllocator& a);
|
||||
};
|
||||
|
||||
/// A special value used for accessing the allocator_t property.
|
||||
constexpr allocator_t<void> allocator;
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
template <typename ProtoAllocator>
|
||||
struct allocator_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
|
||||
|
||||
template <typename T>
|
||||
struct static_proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
static constexpr auto query(ASIO_MOVE_ARG(P) p)
|
||||
noexcept(
|
||||
noexcept(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
{
|
||||
return T::query(ASIO_MOVE_CAST(P)(p));
|
||||
}
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(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(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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename E, typename T = decltype(allocator_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= allocator_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_CONSTEXPR ProtoAllocator value() const
|
||||
{
|
||||
return a_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend struct allocator_t<void>;
|
||||
|
||||
explicit ASIO_CONSTEXPR allocator_t(const ProtoAllocator& a)
|
||||
: a_(a)
|
||||
{
|
||||
}
|
||||
|
||||
ProtoAllocator a_;
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <typename ProtoAllocator> template <typename E, typename T>
|
||||
const T allocator_t<ProtoAllocator>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <>
|
||||
struct allocator_t<void>
|
||||
{
|
||||
#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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
|
||||
|
||||
ASIO_CONSTEXPR allocator_t()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct static_proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
static constexpr auto query(ASIO_MOVE_ARG(P) p)
|
||||
noexcept(
|
||||
noexcept(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
{
|
||||
return T::query(ASIO_MOVE_CAST(P)(p));
|
||||
}
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(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(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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename E, typename T = decltype(allocator_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= allocator_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename OtherProtoAllocator>
|
||||
ASIO_CONSTEXPR allocator_t<OtherProtoAllocator> operator()(
|
||||
const OtherProtoAllocator& a) const
|
||||
{
|
||||
return allocator_t<OtherProtoAllocator>(a);
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <typename E, typename T>
|
||||
const T allocator_t<void>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
constexpr allocator_t<void> allocator;
|
||||
#else // defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
template <typename T>
|
||||
struct allocator_instance
|
||||
{
|
||||
static allocator_t<T> instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
allocator_t<T> allocator_instance<T>::instance;
|
||||
|
||||
namespace {
|
||||
static const allocator_t<void>& allocator = allocator_instance<void>::instance;
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename ProtoAllocator>
|
||||
struct is_applicable_property<T, execution::allocator_t<ProtoAllocator> >
|
||||
: 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>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
|| !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename ProtoAllocator>
|
||||
struct static_query<T, execution::allocator_t<ProtoAllocator>,
|
||||
typename enable_if<
|
||||
execution::allocator_t<ProtoAllocator>::template
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::allocator_t<ProtoAllocator>::template
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::allocator_t<ProtoAllocator>::template
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace traits
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_ALLOCATOR_HPP
|
||||
2346
extern/asio-1.18.2/include/asio/execution/any_executor.hpp
vendored
Normal file
2346
extern/asio-1.18.2/include/asio/execution/any_executor.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
47
extern/asio-1.18.2/include/asio/execution/bad_executor.hpp
vendored
Normal file
47
extern/asio-1.18.2/include/asio/execution/bad_executor.hpp
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// execution/bad_executor.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_BAD_EXECUTOR_HPP
|
||||
#define ASIO_EXECUTION_BAD_EXECUTOR_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include <exception>
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// Exception thrown when trying to access an empty polymorphic executor.
|
||||
class bad_executor
|
||||
: public std::exception
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
ASIO_DECL bad_executor() ASIO_NOEXCEPT;
|
||||
|
||||
/// Obtain message associated with exception.
|
||||
ASIO_DECL virtual const char* what() const
|
||||
ASIO_NOEXCEPT_OR_NOTHROW;
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#if defined(ASIO_HEADER_ONLY)
|
||||
# include "asio/execution/impl/bad_executor.ipp"
|
||||
#endif // defined(ASIO_HEADER_ONLY)
|
||||
|
||||
#endif // ASIO_EXECUTION_BAD_EXECUTOR_HPP
|
||||
1551
extern/asio-1.18.2/include/asio/execution/blocking.hpp
vendored
Normal file
1551
extern/asio-1.18.2/include/asio/execution/blocking.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1212
extern/asio-1.18.2/include/asio/execution/blocking_adaptation.hpp
vendored
Normal file
1212
extern/asio-1.18.2/include/asio/execution/blocking_adaptation.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
395
extern/asio-1.18.2/include/asio/execution/bulk_execute.hpp
vendored
Normal file
395
extern/asio-1.18.2/include/asio/execution/bulk_execute.hpp
vendored
Normal file
@@ -0,0 +1,395 @@
|
||||
//
|
||||
// execution/bulk_execute.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_BULK_EXECUTE_HPP
|
||||
#define ASIO_EXECUTION_BULK_EXECUTE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/bulk_guarantee.hpp"
|
||||
#include "asio/execution/detail/bulk_sender.hpp"
|
||||
#include "asio/execution/executor.hpp"
|
||||
#include "asio/execution/sender.hpp"
|
||||
#include "asio/traits/bulk_execute_member.hpp"
|
||||
#include "asio/traits/bulk_execute_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that creates a bulk sender.
|
||||
/**
|
||||
* The name <tt>execution::bulk_execute</tt> denotes a customisation point
|
||||
* object. If <tt>is_convertible_v<N, size_t></tt> is true, then the expression
|
||||
* <tt>execution::bulk_execute(S, F, N)</tt> for some subexpressions
|
||||
* <tt>S</tt>, <tt>F</tt>, and <tt>N</tt> is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>S.bulk_execute(F, N)</tt>, if that expression is valid. If the
|
||||
* function selected does not execute <tt>N</tt> invocations of the function
|
||||
* object <tt>F</tt> on the executor <tt>S</tt> in bulk with forward progress
|
||||
* guarantee <tt>asio::query(S, execution::bulk_guarantee)</tt>, and
|
||||
* the result of that function does not model <tt>sender<void></tt>, the
|
||||
* program is ill-formed with no diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>bulk_execute(S, F, N)</tt>, if that expression is valid,
|
||||
* with overload resolution performed in a context that includes the
|
||||
* declaration <tt>void bulk_execute();</tt> and that does not include a
|
||||
* declaration of <tt>execution::bulk_execute</tt>. If the function selected
|
||||
* by overload resolution does not execute <tt>N</tt> invocations of the
|
||||
* function object <tt>F</tt> on the executor <tt>S</tt> in bulk with forward
|
||||
* progress guarantee <tt>asio::query(E,
|
||||
* execution::bulk_guarantee)</tt>, and the result of that function does not
|
||||
* model <tt>sender<void></tt>, the program is ill-formed with no diagnostic
|
||||
* required.
|
||||
*
|
||||
* @li Otherwise, if the types <tt>F</tt> and
|
||||
* <tt>executor_index_t<remove_cvref_t<S>></tt> model <tt>invocable</tt> and
|
||||
* if <tt>asio::query(S, execution::bulk_guarantee)</tt> equals
|
||||
* <tt>execution::bulk_guarantee.unsequenced</tt>, then
|
||||
*
|
||||
* - Evaluates <tt>DECAY_COPY(std::forward<decltype(F)>(F))</tt> on the
|
||||
* calling thread to create a function object <tt>cf</tt>. [Note:
|
||||
* Additional copies of <tt>cf</tt> may subsequently be created. --end
|
||||
* note.]
|
||||
*
|
||||
* - For each value of <tt>i</tt> in <tt>N</tt>, <tt>cf(i)</tt> (or copy of
|
||||
* <tt>cf</tt>)) will be invoked at most once by an execution agent that is
|
||||
* unique for each value of <tt>i</tt>.
|
||||
*
|
||||
* - May block pending completion of one or more invocations of <tt>cf</tt>.
|
||||
*
|
||||
* - Synchronizes with (C++Std [intro.multithread]) the invocations of
|
||||
* <tt>cf</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>execution::bulk_execute(S, F, N)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified bulk_execute = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c bulk_execute expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_bulk_execute is a trait that is derived from @c
|
||||
* true_type if the expression <tt>execution::bulk_execute(std::declval<S>(),
|
||||
* std::declval<F>(), std::declval<N>)</tt> is well formed; otherwise @c
|
||||
* false_type.
|
||||
*/
|
||||
template <typename S, typename F, typename N>
|
||||
struct can_bulk_execute :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_bulk_execute_fn {
|
||||
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::execution::bulk_guarantee_t;
|
||||
using asio::execution::detail::bulk_sender;
|
||||
using asio::execution::executor_index;
|
||||
using asio::execution::is_sender;
|
||||
using asio::is_convertible;
|
||||
using asio::is_same;
|
||||
using asio::remove_cvref;
|
||||
using asio::result_of;
|
||||
using asio::traits::bulk_execute_free;
|
||||
using asio::traits::bulk_execute_member;
|
||||
using asio::traits::static_require;
|
||||
|
||||
void bulk_execute();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
adapter,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename S, typename Args, typename = void, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
struct call_traits<S, void(F, N),
|
||||
typename enable_if<
|
||||
is_convertible<N, std::size_t>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
bulk_execute_member<S, F, N>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender<
|
||||
typename bulk_execute_member<S, F, N>::result_type
|
||||
>::value
|
||||
>::type> :
|
||||
bulk_execute_member<S, F, N>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
struct call_traits<S, void(F, N),
|
||||
typename enable_if<
|
||||
is_convertible<N, std::size_t>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!bulk_execute_member<S, F, N>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
bulk_execute_free<S, F, N>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender<
|
||||
typename bulk_execute_free<S, F, N>::result_type
|
||||
>::value
|
||||
>::type> :
|
||||
bulk_execute_free<S, F, N>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
struct call_traits<S, void(F, N),
|
||||
typename enable_if<
|
||||
is_convertible<N, std::size_t>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!bulk_execute_member<S, F, N>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!bulk_execute_free<S, F, N>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender<S>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_same<
|
||||
typename result_of<
|
||||
F(typename executor_index<typename remove_cvref<S>::type>::type)
|
||||
>::type,
|
||||
typename result_of<
|
||||
F(typename executor_index<typename remove_cvref<S>::type>::type)
|
||||
>::type
|
||||
>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
static_require<S, bulk_guarantee_t::unsequenced_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = adapter);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef bulk_sender<S, F, N> result_type;
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(F, N)>::overload == call_member,
|
||||
typename call_traits<S, void(F, N)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, F&& f, N&& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(F, N)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(S)(s).bulk_execute(
|
||||
ASIO_MOVE_CAST(F)(f), ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(F, N)>::overload == call_free,
|
||||
typename call_traits<S, void(F, N)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, F&& f, N&& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(F, N)>::is_noexcept))
|
||||
{
|
||||
return bulk_execute(ASIO_MOVE_CAST(S)(s),
|
||||
ASIO_MOVE_CAST(F)(f), ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(F, N)>::overload == adapter,
|
||||
typename call_traits<S, void(F, N)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, F&& f, N&& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(F, N)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<S, void(F, N)>::result_type(
|
||||
ASIO_MOVE_CAST(S)(s), ASIO_MOVE_CAST(F)(f),
|
||||
ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(const F&, const N&)>::overload == call_member,
|
||||
typename call_traits<S, void(const F&, const N&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const F& f, const N& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(const F&, const N&)>::is_noexcept))
|
||||
{
|
||||
return s.bulk_execute(ASIO_MOVE_CAST(F)(f),
|
||||
ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(const F&, const N&)>::overload == call_member,
|
||||
typename call_traits<S, void(const F&, const N&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const F& f, const N& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(const F&, const N&)>::is_noexcept))
|
||||
{
|
||||
return s.bulk_execute(ASIO_MOVE_CAST(F)(f),
|
||||
ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(const F&, const N&)>::overload == call_free,
|
||||
typename call_traits<S, void(const F&, const N&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const F& f, const N& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(const F&, const N&)>::is_noexcept))
|
||||
{
|
||||
return bulk_execute(s, ASIO_MOVE_CAST(F)(f),
|
||||
ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(const F&, const N&)>::overload == call_free,
|
||||
typename call_traits<S, void(const F&, const N&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const F& f, const N& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(const F&, const N&)>::is_noexcept))
|
||||
{
|
||||
return bulk_execute(s, ASIO_MOVE_CAST(F)(f),
|
||||
ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(const F&, const N&)>::overload == adapter,
|
||||
typename call_traits<S, void(const F&, const N&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const F& f, const N& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(const F&, const N&)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<S, void(const F&, const N&)>::result_type(
|
||||
s, ASIO_MOVE_CAST(F)(f), ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(const F&, const N&)>::overload == adapter,
|
||||
typename call_traits<S, void(const F&, const N&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const F& f, const N& n) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(const F&, const N&)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<S, void(const F&, const N&)>::result_type(
|
||||
s, ASIO_MOVE_CAST(F)(f), ASIO_MOVE_CAST(N)(n));
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_bulk_execute_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR
|
||||
const asio_execution_bulk_execute_fn::impl& bulk_execute =
|
||||
asio_execution_bulk_execute_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
struct can_bulk_execute :
|
||||
integral_constant<bool,
|
||||
asio_execution_bulk_execute_fn::call_traits<S, void(F, N)>::overload !=
|
||||
asio_execution_bulk_execute_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
constexpr bool can_bulk_execute_v = can_bulk_execute<S, F, N>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
struct is_nothrow_bulk_execute :
|
||||
integral_constant<bool,
|
||||
asio_execution_bulk_execute_fn::call_traits<S, void(F, N)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
constexpr bool is_nothrow_bulk_execute_v
|
||||
= is_nothrow_bulk_execute<S, F, N>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
struct bulk_execute_result
|
||||
{
|
||||
typedef typename asio_execution_bulk_execute_fn::call_traits<
|
||||
S, void(F, N)>::result_type type;
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_BULK_EXECUTE_HPP
|
||||
1215
extern/asio-1.18.2/include/asio/execution/bulk_guarantee.hpp
vendored
Normal file
1215
extern/asio-1.18.2/include/asio/execution/bulk_guarantee.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
489
extern/asio-1.18.2/include/asio/execution/connect.hpp
vendored
Normal file
489
extern/asio-1.18.2/include/asio/execution/connect.hpp
vendored
Normal file
@@ -0,0 +1,489 @@
|
||||
//
|
||||
// execution/connect.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_CONNECT_HPP
|
||||
#define ASIO_EXECUTION_CONNECT_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/detail/as_invocable.hpp"
|
||||
#include "asio/execution/detail/as_operation.hpp"
|
||||
#include "asio/execution/detail/as_receiver.hpp"
|
||||
#include "asio/execution/executor.hpp"
|
||||
#include "asio/execution/operation_state.hpp"
|
||||
#include "asio/execution/receiver.hpp"
|
||||
#include "asio/execution/sender.hpp"
|
||||
#include "asio/traits/connect_member.hpp"
|
||||
#include "asio/traits/connect_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that connects a sender to a receiver.
|
||||
/**
|
||||
* The name <tt>execution::connect</tt> denotes a customisation point object.
|
||||
* For some subexpressions <tt>s</tt> and <tt>r</tt>, let <tt>S</tt> be a type
|
||||
* such that <tt>decltype((s))</tt> is <tt>S</tt> and let <tt>R</tt> be a type
|
||||
* such that <tt>decltype((r))</tt> is <tt>R</tt>. The expression
|
||||
* <tt>execution::connect(s, r)</tt> is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>s.connect(r)</tt>, if that expression is valid, if its type
|
||||
* satisfies <tt>operation_state</tt>, and if <tt>S</tt> satisfies
|
||||
* <tt>sender</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>connect(s, r)</tt>, if that expression is valid, if its
|
||||
* type satisfies <tt>operation_state</tt>, and if <tt>S</tt> satisfies
|
||||
* <tt>sender</tt>, with overload resolution performed in a context that
|
||||
* includes the declaration <tt>void connect();</tt> and that does not include
|
||||
* a declaration of <tt>execution::connect</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>as_operation{s, r}</tt>, if <tt>r</tt> is not an instance
|
||||
* of <tt>as_receiver<F, S></tt> for some type <tt>F</tt>, and if
|
||||
* <tt>receiver_of<R> && executor_of<remove_cvref_t<S>,
|
||||
* as_invocable<remove_cvref_t<R>, S>></tt> is <tt>true</tt>, where
|
||||
* <tt>as_operation</tt> is an implementation-defined class equivalent to
|
||||
* @code template <class S, class R>
|
||||
* struct as_operation
|
||||
* {
|
||||
* remove_cvref_t<S> e_;
|
||||
* remove_cvref_t<R> r_;
|
||||
* void start() noexcept try {
|
||||
* execution::execute(std::move(e_),
|
||||
* as_invocable<remove_cvref_t<R>, S>{r_});
|
||||
* } catch(...) {
|
||||
* execution::set_error(std::move(r_), current_exception());
|
||||
* }
|
||||
* }; @endcode
|
||||
* and <tt>as_invocable</tt> is a class template equivalent to the following:
|
||||
* @code template<class R>
|
||||
* struct as_invocable
|
||||
* {
|
||||
* R* r_;
|
||||
* explicit as_invocable(R& r) noexcept
|
||||
* : r_(std::addressof(r)) {}
|
||||
* as_invocable(as_invocable && other) noexcept
|
||||
* : r_(std::exchange(other.r_, nullptr)) {}
|
||||
* ~as_invocable() {
|
||||
* if(r_)
|
||||
* execution::set_done(std::move(*r_));
|
||||
* }
|
||||
* void operator()() & noexcept try {
|
||||
* execution::set_value(std::move(*r_));
|
||||
* r_ = nullptr;
|
||||
* } catch(...) {
|
||||
* execution::set_error(std::move(*r_), current_exception());
|
||||
* r_ = nullptr;
|
||||
* }
|
||||
* };
|
||||
* @endcode
|
||||
*
|
||||
* @li Otherwise, <tt>execution::connect(s, r)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified connect = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c connect expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_connect is a trait that is derived from
|
||||
* @c true_type if the expression <tt>execution::connect(std::declval<S>(),
|
||||
* std::declval<R>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename S, typename R>
|
||||
struct can_connect :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
/// A type trait to determine the result of a @c connect expression.
|
||||
template <typename S, typename R>
|
||||
struct connect_result
|
||||
{
|
||||
/// The type of the connect expression.
|
||||
/**
|
||||
* The type of the expression <tt>execution::connect(std::declval<S>(),
|
||||
* std::declval<R>())</tt>.
|
||||
*/
|
||||
typedef automatically_determined type;
|
||||
};
|
||||
|
||||
/// A type alis to determine the result of a @c connect expression.
|
||||
template <typename S, typename R>
|
||||
using connect_result_t = typename connect_result<S, R>::type;
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_connect_fn {
|
||||
|
||||
using asio::conditional;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::execution::detail::as_invocable;
|
||||
using asio::execution::detail::as_operation;
|
||||
using asio::execution::detail::is_as_receiver;
|
||||
using asio::execution::is_executor_of;
|
||||
using asio::execution::is_operation_state;
|
||||
using asio::execution::is_receiver;
|
||||
using asio::execution::is_sender;
|
||||
using asio::false_type;
|
||||
using asio::remove_cvref;
|
||||
using asio::traits::connect_free;
|
||||
using asio::traits::connect_member;
|
||||
|
||||
void connect();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
adapter,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename S, typename R, typename = void,
|
||||
typename = void, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename S, typename R>
|
||||
struct call_traits<S, void(R),
|
||||
typename enable_if<
|
||||
connect_member<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_operation_state<typename connect_member<S, R>::result_type>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender<typename remove_cvref<S>::type>::value
|
||||
>::type> :
|
||||
connect_member<S, R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename S, typename R>
|
||||
struct call_traits<S, void(R),
|
||||
typename enable_if<
|
||||
!connect_member<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
connect_free<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_operation_state<typename connect_free<S, R>::result_type>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender<typename remove_cvref<S>::type>::value
|
||||
>::type> :
|
||||
connect_free<S, R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
template <typename S, typename R>
|
||||
struct call_traits<S, void(R),
|
||||
typename enable_if<
|
||||
!connect_member<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!connect_free<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_receiver<R>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
conditional<
|
||||
!is_as_receiver<
|
||||
typename remove_cvref<R>::type
|
||||
>::value,
|
||||
is_executor_of<
|
||||
typename remove_cvref<S>::type,
|
||||
as_invocable<typename remove_cvref<R>::type, S>
|
||||
>,
|
||||
false_type
|
||||
>::type::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = adapter);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef as_operation<S, R> result_type;
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(R)>::overload == call_member,
|
||||
typename call_traits<S, void(R)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(R)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(S)(s).connect(ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(R)>::overload == call_free,
|
||||
typename call_traits<S, void(R)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(R)>::is_noexcept))
|
||||
{
|
||||
return connect(ASIO_MOVE_CAST(S)(s), ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(R)>::overload == adapter,
|
||||
typename call_traits<S, void(R)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(R)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<S, void(R)>::result_type(
|
||||
ASIO_MOVE_CAST(S)(s), ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(R&)>::overload == call_member,
|
||||
typename call_traits<S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return s.connect(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(R&)>::overload == call_member,
|
||||
typename call_traits<const S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return s.connect(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(R&)>::overload == call_free,
|
||||
typename call_traits<S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return connect(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(R&)>::overload == call_free,
|
||||
typename call_traits<const S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return connect(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(R&)>::overload == adapter,
|
||||
typename call_traits<S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<S&, void(R&)>::result_type(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(R&)>::overload == adapter,
|
||||
typename call_traits<const S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<const S&, void(R&)>::result_type(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(const R&)>::overload == call_member,
|
||||
typename call_traits<S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return s.connect(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(const R&)>::overload == call_member,
|
||||
typename call_traits<const S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return s.connect(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(const R&)>::overload == call_free,
|
||||
typename call_traits<S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return connect(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(const R&)>::overload == call_free,
|
||||
typename call_traits<const S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return connect(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(const R&)>::overload == adapter,
|
||||
typename call_traits<S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<S&, void(const R&)>::result_type(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(const R&)>::overload == adapter,
|
||||
typename call_traits<const S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return typename call_traits<const S&, void(const R&)>::result_type(s, r);
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_connect_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_connect_fn::impl&
|
||||
connect = asio_execution_connect_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename S, typename R>
|
||||
struct can_connect :
|
||||
integral_constant<bool,
|
||||
asio_execution_connect_fn::call_traits<S, void(R)>::overload !=
|
||||
asio_execution_connect_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
constexpr bool can_connect_v = can_connect<S, R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
struct is_nothrow_connect :
|
||||
integral_constant<bool,
|
||||
asio_execution_connect_fn::call_traits<S, void(R)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
constexpr bool is_nothrow_connect_v
|
||||
= is_nothrow_connect<S, R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
struct connect_result
|
||||
{
|
||||
typedef typename asio_execution_connect_fn::call_traits<
|
||||
S, void(R)>::result_type type;
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
using connect_result_t = typename connect_result<S, R>::type;
|
||||
|
||||
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_CONNECT_HPP
|
||||
233
extern/asio-1.18.2/include/asio/execution/context.hpp
vendored
Normal file
233
extern/asio-1.18.2/include/asio/execution/context.hpp
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
//
|
||||
// execution/context.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_CONTEXT2_HPP
|
||||
#define ASIO_EXECUTION_CONTEXT2_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#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/traits/query_static_constexpr_member.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_STD_ANY)
|
||||
# include <any>
|
||||
#endif // defined(ASIO_HAS_STD_ANY)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
/// A property that is used to obtain the execution context that is associated
|
||||
/// with an executor.
|
||||
struct context_t
|
||||
{
|
||||
/// The context_t property applies to executors, senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The context_t property cannot be required.
|
||||
static constexpr bool is_requirable = false;
|
||||
|
||||
/// The context_t property cannot be preferred.
|
||||
static constexpr bool is_preferable = false;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef std::any polymorphic_query_result_type;
|
||||
};
|
||||
|
||||
/// A special value used for accessing the context_t property.
|
||||
constexpr context_t context;
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <int I = 0>
|
||||
struct context_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
|
||||
|
||||
#if defined(ASIO_HAS_STD_ANY)
|
||||
typedef std::any polymorphic_query_result_type;
|
||||
#endif // defined(ASIO_HAS_STD_ANY)
|
||||
|
||||
ASIO_CONSTEXPR context_t()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct static_proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
static constexpr auto query(ASIO_MOVE_ARG(P) p)
|
||||
noexcept(
|
||||
noexcept(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
{
|
||||
return T::query(ASIO_MOVE_CAST(P)(p));
|
||||
}
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(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, context_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
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 ASIO_CONSTEXPR const T static_query_v
|
||||
= context_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
#if !defined(ASIO_HAS_CONSTEXPR)
|
||||
static const context_t instance;
|
||||
#endif // !defined(ASIO_HAS_CONSTEXPR)
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T context_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 context_t<I> context_t<I>::instance;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
typedef detail::context_t<> context_t;
|
||||
|
||||
#if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
constexpr context_t context;
|
||||
#else // defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
namespace { static const context_t& context = context_t::instance; }
|
||||
#endif
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::context_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>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
|| !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::context_t,
|
||||
typename enable_if<
|
||||
execution::detail::context_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::context_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::context_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace traits
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_CONTEXT2_HPP
|
||||
221
extern/asio-1.18.2/include/asio/execution/context_as.hpp
vendored
Normal file
221
extern/asio-1.18.2/include/asio/execution/context_as.hpp
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
//
|
||||
// execution/context_as.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_CONTEXT_AS_HPP
|
||||
#define ASIO_EXECUTION_CONTEXT_AS_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/context.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_static_constexpr_member.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
/// A property that is used to obtain the execution context that is associated
|
||||
/// with an executor.
|
||||
template <typename U>
|
||||
struct context_as_t
|
||||
{
|
||||
/// The context_as_t property applies to executors, senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The context_t property cannot be required.
|
||||
static constexpr bool is_requirable = false;
|
||||
|
||||
/// The context_t property cannot be preferred.
|
||||
static constexpr bool is_preferable = false;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef T polymorphic_query_result_type;
|
||||
};
|
||||
|
||||
/// A special value used for accessing the context_as_t property.
|
||||
template <typename U>
|
||||
constexpr context_as_t context_as;
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
template <typename T>
|
||||
struct context_as_t
|
||||
{
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
template <typename U>
|
||||
ASIO_STATIC_CONSTEXPR(bool,
|
||||
is_applicable_property_v = (
|
||||
is_executor<U>::value
|
||||
|| conditional<
|
||||
is_executor<U>::value,
|
||||
false_type,
|
||||
is_sender<U>
|
||||
>::type::value
|
||||
|| conditional<
|
||||
is_executor<U>::value,
|
||||
false_type,
|
||||
is_scheduler<U>
|
||||
>::type::value));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
|
||||
|
||||
typedef T polymorphic_query_result_type;
|
||||
|
||||
ASIO_CONSTEXPR context_as_t()
|
||||
{
|
||||
}
|
||||
|
||||
ASIO_CONSTEXPR context_as_t(context_t)
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <typename E>
|
||||
static ASIO_CONSTEXPR
|
||||
typename context_t::query_static_constexpr_member<E>::result_type
|
||||
static_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
context_t::query_static_constexpr_member<E>::is_noexcept))
|
||||
{
|
||||
return context_t::query_static_constexpr_member<E>::value();
|
||||
}
|
||||
|
||||
template <typename E, typename U = decltype(context_as_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const U static_query_v
|
||||
= context_as_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename Executor, typename U>
|
||||
friend ASIO_CONSTEXPR U query(
|
||||
const Executor& ex, const context_as_t<U>&,
|
||||
typename enable_if<
|
||||
is_same<T, U>::value
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
can_query<const Executor&, const context_t&>::value
|
||||
>::type* = 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&, const context_t&>::value))
|
||||
#else // defined(ASIO_MSVC)
|
||||
ASIO_NOEXCEPT_IF((
|
||||
is_nothrow_query<const Executor&, const context_t&>::value))
|
||||
#endif // defined(ASIO_MSVC)
|
||||
#endif // !defined(__clang__)
|
||||
{
|
||||
return asio::query(ex, context);
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <typename T> template <typename E, typename U>
|
||||
const U context_as_t<T>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
#if (defined(ASIO_HAS_VARIABLE_TEMPLATES) \
|
||||
&& defined(ASIO_HAS_CONSTEXPR)) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
template <typename T>
|
||||
constexpr context_as_t<T> context_as{};
|
||||
#endif // (defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
// && defined(ASIO_HAS_CONSTEXPR))
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename U>
|
||||
struct is_applicable_property<T, execution::context_as_t<U> >
|
||||
: 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>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
|| !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename U>
|
||||
struct static_query<T, execution::context_as_t<U>,
|
||||
typename enable_if<
|
||||
static_query<T, execution::context_t>::is_valid
|
||||
>::type> : static_query<T, execution::context_t>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename U>
|
||||
struct query_free<T, execution::context_as_t<U>,
|
||||
typename enable_if<
|
||||
can_query<const T&, const execution::context_t&>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(is_nothrow_query<const T&, const execution::context_t&>::value));
|
||||
|
||||
typedef U result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_CONTEXT_AS_HPP
|
||||
152
extern/asio-1.18.2/include/asio/execution/detail/as_invocable.hpp
vendored
Normal file
152
extern/asio-1.18.2/include/asio/execution/detail/as_invocable.hpp
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// execution/detail/as_invocable.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_DETAIL_AS_INVOCABLE_HPP
|
||||
#define ASIO_EXECUTION_DETAIL_AS_INVOCABLE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/atomic_count.hpp"
|
||||
#include "asio/detail/memory.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/receiver_invocation_error.hpp"
|
||||
#include "asio/execution/set_done.hpp"
|
||||
#include "asio/execution/set_error.hpp"
|
||||
#include "asio/execution/set_value.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
|
||||
template <typename Receiver, typename>
|
||||
struct as_invocable
|
||||
{
|
||||
Receiver* receiver_;
|
||||
|
||||
explicit as_invocable(Receiver& r) ASIO_NOEXCEPT
|
||||
: receiver_(asio::detail::addressof(r))
|
||||
{
|
||||
}
|
||||
|
||||
as_invocable(as_invocable&& other) ASIO_NOEXCEPT
|
||||
: receiver_(other.receiver_)
|
||||
{
|
||||
other.receiver_ = 0;
|
||||
}
|
||||
|
||||
~as_invocable()
|
||||
{
|
||||
if (receiver_)
|
||||
execution::set_done(ASIO_MOVE_OR_LVALUE(Receiver)(*receiver_));
|
||||
}
|
||||
|
||||
void operator()() ASIO_LVALUE_REF_QUAL ASIO_NOEXCEPT
|
||||
{
|
||||
#if !defined(ASIO_NO_EXCEPTIONS)
|
||||
try
|
||||
{
|
||||
#endif // !defined(ASIO_NO_EXCEPTIONS)
|
||||
execution::set_value(ASIO_MOVE_CAST(Receiver)(*receiver_));
|
||||
receiver_ = 0;
|
||||
#if !defined(ASIO_NO_EXCEPTIONS)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
#if defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
execution::set_error(ASIO_MOVE_CAST(Receiver)(*receiver_),
|
||||
std::make_exception_ptr(receiver_invocation_error()));
|
||||
receiver_ = 0;
|
||||
#else // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
std::terminate();
|
||||
#endif // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
}
|
||||
#endif // !defined(ASIO_NO_EXCEPTIONS)
|
||||
}
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
|
||||
template <typename Receiver, typename>
|
||||
struct as_invocable
|
||||
{
|
||||
Receiver* receiver_;
|
||||
asio::detail::shared_ptr<asio::detail::atomic_count> ref_count_;
|
||||
|
||||
explicit as_invocable(Receiver& r,
|
||||
const asio::detail::shared_ptr<
|
||||
asio::detail::atomic_count>& c) ASIO_NOEXCEPT
|
||||
: receiver_(asio::detail::addressof(r)),
|
||||
ref_count_(c)
|
||||
{
|
||||
}
|
||||
|
||||
as_invocable(const as_invocable& other) ASIO_NOEXCEPT
|
||||
: receiver_(other.receiver_),
|
||||
ref_count_(other.ref_count_)
|
||||
{
|
||||
++(*ref_count_);
|
||||
}
|
||||
|
||||
~as_invocable()
|
||||
{
|
||||
if (--(*ref_count_) == 0)
|
||||
execution::set_done(*receiver_);
|
||||
}
|
||||
|
||||
void operator()() ASIO_LVALUE_REF_QUAL ASIO_NOEXCEPT
|
||||
{
|
||||
#if !defined(ASIO_NO_EXCEPTIONS)
|
||||
try
|
||||
{
|
||||
#endif // !defined(ASIO_NO_EXCEPTIONS)
|
||||
execution::set_value(*receiver_);
|
||||
++(*ref_count_);
|
||||
}
|
||||
#if !defined(ASIO_NO_EXCEPTIONS)
|
||||
catch (...)
|
||||
{
|
||||
#if defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
execution::set_error(*receiver_,
|
||||
std::make_exception_ptr(receiver_invocation_error()));
|
||||
++(*ref_count_);
|
||||
#else // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
std::terminate();
|
||||
#endif // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
}
|
||||
#endif // !defined(ASIO_NO_EXCEPTIONS)
|
||||
}
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
|
||||
template <typename T>
|
||||
struct is_as_invocable : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename Function, typename T>
|
||||
struct is_as_invocable<as_invocable<Function, T> > : true_type
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_DETAIL_AS_INVOCABLE_HPP
|
||||
105
extern/asio-1.18.2/include/asio/execution/detail/as_operation.hpp
vendored
Normal file
105
extern/asio-1.18.2/include/asio/execution/detail/as_operation.hpp
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// execution/detail/as_operation.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_DETAIL_AS_OPERATION_HPP
|
||||
#define ASIO_EXECUTION_DETAIL_AS_OPERATION_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/memory.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/detail/as_invocable.hpp"
|
||||
#include "asio/execution/execute.hpp"
|
||||
#include "asio/execution/set_error.hpp"
|
||||
#include "asio/traits/start_member.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename Executor, typename Receiver>
|
||||
struct as_operation
|
||||
{
|
||||
typename remove_cvref<Executor>::type ex_;
|
||||
typename remove_cvref<Receiver>::type receiver_;
|
||||
#if !defined(ASIO_HAS_MOVE)
|
||||
asio::detail::shared_ptr<asio::detail::atomic_count> ref_count_;
|
||||
#endif // !defined(ASIO_HAS_MOVE)
|
||||
|
||||
template <typename E, typename R>
|
||||
explicit as_operation(ASIO_MOVE_ARG(E) e, ASIO_MOVE_ARG(R) r)
|
||||
: ex_(ASIO_MOVE_CAST(E)(e)),
|
||||
receiver_(ASIO_MOVE_CAST(R)(r))
|
||||
#if !defined(ASIO_HAS_MOVE)
|
||||
, ref_count_(new asio::detail::atomic_count(1))
|
||||
#endif // !defined(ASIO_HAS_MOVE)
|
||||
{
|
||||
}
|
||||
|
||||
void start() ASIO_NOEXCEPT
|
||||
{
|
||||
#if !defined(ASIO_NO_EXCEPTIONS)
|
||||
try
|
||||
{
|
||||
#endif // !defined(ASIO_NO_EXCEPTIONS)
|
||||
execution::execute(
|
||||
ASIO_MOVE_CAST(typename remove_cvref<Executor>::type)(ex_),
|
||||
as_invocable<typename remove_cvref<Receiver>::type,
|
||||
Executor>(receiver_
|
||||
#if !defined(ASIO_HAS_MOVE)
|
||||
, ref_count_
|
||||
#endif // !defined(ASIO_HAS_MOVE)
|
||||
));
|
||||
#if !defined(ASIO_NO_EXCEPTIONS)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
#if defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
execution::set_error(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(
|
||||
receiver_),
|
||||
std::current_exception());
|
||||
#else // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
std::terminate();
|
||||
#endif // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
}
|
||||
#endif // !defined(ASIO_NO_EXCEPTIONS)
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
|
||||
|
||||
template <typename Executor, typename Receiver>
|
||||
struct start_member<
|
||||
asio::execution::detail::as_operation<Executor, Receiver> >
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_DETAIL_AS_OPERATION_HPP
|
||||
128
extern/asio-1.18.2/include/asio/execution/detail/as_receiver.hpp
vendored
Normal file
128
extern/asio-1.18.2/include/asio/execution/detail/as_receiver.hpp
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// execution/detail/as_receiver.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_DETAIL_AS_RECEIVER_HPP
|
||||
#define ASIO_EXECUTION_DETAIL_AS_RECEIVER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/traits/set_done_member.hpp"
|
||||
#include "asio/traits/set_error_member.hpp"
|
||||
#include "asio/traits/set_value_member.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename Function, typename>
|
||||
struct as_receiver
|
||||
{
|
||||
Function f_;
|
||||
|
||||
template <typename F>
|
||||
explicit as_receiver(ASIO_MOVE_ARG(F) f, int)
|
||||
: f_(ASIO_MOVE_CAST(F)(f))
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(ASIO_MSVC) && defined(ASIO_HAS_MOVE)
|
||||
as_receiver(as_receiver&& other)
|
||||
: f_(ASIO_MOVE_CAST(Function)(other.f_))
|
||||
{
|
||||
}
|
||||
#endif // defined(ASIO_MSVC) && defined(ASIO_HAS_MOVE)
|
||||
|
||||
void set_value()
|
||||
ASIO_NOEXCEPT_IF(noexcept(declval<Function&>()()))
|
||||
{
|
||||
f_();
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
void set_error(E) ASIO_NOEXCEPT
|
||||
{
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
void set_done() ASIO_NOEXCEPT
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_as_receiver : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename Function, typename T>
|
||||
struct is_as_receiver<as_receiver<Function, T> > : true_type
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
template <typename Function, typename T>
|
||||
struct set_value_member<
|
||||
asio::execution::detail::as_receiver<Function, T>, void()>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
#if defined(ASIO_HAS_NOEXCEPT)
|
||||
ASIO_STATIC_CONSTEXPR(bool,
|
||||
is_noexcept = noexcept(declval<Function&>()()));
|
||||
#else // defined(ASIO_HAS_NOEXCEPT)
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
#endif // defined(ASIO_HAS_NOEXCEPT)
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
template <typename Function, typename T, typename E>
|
||||
struct set_error_member<
|
||||
asio::execution::detail::as_receiver<Function, T>, E>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
template <typename Function, typename T>
|
||||
struct set_done_member<
|
||||
asio::execution::detail::as_receiver<Function, T> >
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_DETAIL_AS_RECEIVER_HPP
|
||||
261
extern/asio-1.18.2/include/asio/execution/detail/bulk_sender.hpp
vendored
Normal file
261
extern/asio-1.18.2/include/asio/execution/detail/bulk_sender.hpp
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
//
|
||||
// execution/detail/bulk_sender.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_DETAIL_BULK_SENDER_HPP
|
||||
#define ASIO_EXECUTION_DETAIL_BULK_SENDER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/connect.hpp"
|
||||
#include "asio/execution/executor.hpp"
|
||||
#include "asio/execution/set_done.hpp"
|
||||
#include "asio/execution/set_error.hpp"
|
||||
#include "asio/traits/connect_member.hpp"
|
||||
#include "asio/traits/set_done_member.hpp"
|
||||
#include "asio/traits/set_error_member.hpp"
|
||||
#include "asio/traits/set_value_member.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename Receiver, typename Function, typename Number, typename Index>
|
||||
struct bulk_receiver
|
||||
{
|
||||
typename remove_cvref<Receiver>::type receiver_;
|
||||
typename decay<Function>::type f_;
|
||||
typename decay<Number>::type n_;
|
||||
|
||||
template <typename R, typename F, typename N>
|
||||
explicit bulk_receiver(ASIO_MOVE_ARG(R) r,
|
||||
ASIO_MOVE_ARG(F) f, ASIO_MOVE_ARG(N) n)
|
||||
: receiver_(ASIO_MOVE_CAST(R)(r)),
|
||||
f_(ASIO_MOVE_CAST(F)(f)),
|
||||
n_(ASIO_MOVE_CAST(N)(n))
|
||||
{
|
||||
}
|
||||
|
||||
void set_value()
|
||||
{
|
||||
for (Index i = 0; i < n_; ++i)
|
||||
f_(i);
|
||||
|
||||
execution::set_value(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(receiver_));
|
||||
}
|
||||
|
||||
template <typename Error>
|
||||
void set_error(ASIO_MOVE_ARG(Error) e) ASIO_NOEXCEPT
|
||||
{
|
||||
execution::set_error(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(receiver_),
|
||||
ASIO_MOVE_CAST(Error)(e));
|
||||
}
|
||||
|
||||
void set_done() ASIO_NOEXCEPT
|
||||
{
|
||||
execution::set_done(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(receiver_));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sender, typename Receiver,
|
||||
typename Function, typename Number>
|
||||
struct bulk_receiver_traits
|
||||
{
|
||||
typedef bulk_receiver<
|
||||
Receiver, Function, Number,
|
||||
typename execution::executor_index<
|
||||
typename remove_cvref<Sender>::type
|
||||
>::type
|
||||
> type;
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
typedef type arg_type;
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
typedef const type& arg_type;
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename Sender, typename Function, typename Number>
|
||||
struct bulk_sender : sender_base
|
||||
{
|
||||
typename remove_cvref<Sender>::type sender_;
|
||||
typename decay<Function>::type f_;
|
||||
typename decay<Number>::type n_;
|
||||
|
||||
template <typename S, typename F, typename N>
|
||||
explicit bulk_sender(ASIO_MOVE_ARG(S) s,
|
||||
ASIO_MOVE_ARG(F) f, ASIO_MOVE_ARG(N) n)
|
||||
: sender_(ASIO_MOVE_CAST(S)(s)),
|
||||
f_(ASIO_MOVE_CAST(F)(f)),
|
||||
n_(ASIO_MOVE_CAST(N)(n))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Receiver>
|
||||
typename connect_result<
|
||||
ASIO_MOVE_OR_LVALUE_TYPE(typename remove_cvref<Sender>::type),
|
||||
typename bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::type connect(ASIO_MOVE_ARG(Receiver) r,
|
||||
typename enable_if<
|
||||
can_connect<
|
||||
typename remove_cvref<Sender>::type,
|
||||
typename bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::value
|
||||
>::type* = 0) ASIO_RVALUE_REF_QUAL ASIO_NOEXCEPT
|
||||
{
|
||||
return execution::connect(
|
||||
ASIO_MOVE_OR_LVALUE(typename remove_cvref<Sender>::type)(sender_),
|
||||
typename bulk_receiver_traits<Sender, Receiver, Function, Number>::type(
|
||||
ASIO_MOVE_CAST(Receiver)(r),
|
||||
ASIO_MOVE_CAST(typename decay<Function>::type)(f_),
|
||||
ASIO_MOVE_CAST(typename decay<Number>::type)(n_)));
|
||||
}
|
||||
|
||||
template <typename Receiver>
|
||||
typename connect_result<
|
||||
const typename remove_cvref<Sender>::type&,
|
||||
typename bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::type connect(ASIO_MOVE_ARG(Receiver) r,
|
||||
typename enable_if<
|
||||
can_connect<
|
||||
const typename remove_cvref<Sender>::type&,
|
||||
typename bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::value
|
||||
>::type* = 0) const ASIO_LVALUE_REF_QUAL ASIO_NOEXCEPT
|
||||
{
|
||||
return execution::connect(sender_,
|
||||
typename bulk_receiver_traits<Sender, Receiver, Function, Number>::type(
|
||||
ASIO_MOVE_CAST(Receiver)(r), f_, n_));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
template <typename Receiver, typename Function, typename Number, typename Index>
|
||||
struct set_value_member<
|
||||
execution::detail::bulk_receiver<Receiver, Function, Number, Index>,
|
||||
void()>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
template <typename Receiver, typename Function,
|
||||
typename Number, typename Index, typename Error>
|
||||
struct set_error_member<
|
||||
execution::detail::bulk_receiver<Receiver, Function, Number, Index>,
|
||||
Error>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
template <typename Receiver, typename Function, typename Number, typename Index>
|
||||
struct set_done_member<
|
||||
execution::detail::bulk_receiver<Receiver, Function, Number, Index> >
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_CONNECT_MEMBER_TRAIT)
|
||||
|
||||
template <typename Sender, typename Function,
|
||||
typename Number, typename Receiver>
|
||||
struct connect_member<
|
||||
execution::detail::bulk_sender<Sender, Function, Number>,
|
||||
Receiver,
|
||||
typename enable_if<
|
||||
execution::can_connect<
|
||||
ASIO_MOVE_OR_LVALUE_TYPE(typename remove_cvref<Sender>::type),
|
||||
typename execution::detail::bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef typename execution::connect_result<
|
||||
ASIO_MOVE_OR_LVALUE_TYPE(typename remove_cvref<Sender>::type),
|
||||
typename execution::detail::bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::type result_type;
|
||||
};
|
||||
|
||||
template <typename Sender, typename Function,
|
||||
typename Number, typename Receiver>
|
||||
struct connect_member<
|
||||
const execution::detail::bulk_sender<Sender, Function, Number>,
|
||||
Receiver,
|
||||
typename enable_if<
|
||||
execution::can_connect<
|
||||
const typename remove_cvref<Sender>::type&,
|
||||
typename execution::detail::bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef typename execution::connect_result<
|
||||
const typename remove_cvref<Sender>::type&,
|
||||
typename execution::detail::bulk_receiver_traits<
|
||||
Sender, Receiver, Function, Number
|
||||
>::arg_type
|
||||
>::type result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_CONNECT_MEMBER_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_DETAIL_BULK_SENDER_HPP
|
||||
233
extern/asio-1.18.2/include/asio/execution/detail/submit_receiver.hpp
vendored
Normal file
233
extern/asio-1.18.2/include/asio/execution/detail/submit_receiver.hpp
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
//
|
||||
// execution/detail/submit_receiver.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_DETAIL_SUBMIT_RECEIVER_HPP
|
||||
#define ASIO_EXECUTION_DETAIL_SUBMIT_RECEIVER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/detail/variadic_templates.hpp"
|
||||
#include "asio/execution/connect.hpp"
|
||||
#include "asio/execution/receiver.hpp"
|
||||
#include "asio/execution/set_done.hpp"
|
||||
#include "asio/execution/set_error.hpp"
|
||||
#include "asio/execution/set_value.hpp"
|
||||
#include "asio/traits/set_done_member.hpp"
|
||||
#include "asio/traits/set_error_member.hpp"
|
||||
#include "asio/traits/set_value_member.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename Sender, typename Receiver>
|
||||
struct submit_receiver;
|
||||
|
||||
template <typename Sender, typename Receiver>
|
||||
struct submit_receiver_wrapper
|
||||
{
|
||||
submit_receiver<Sender, Receiver>* p_;
|
||||
|
||||
explicit submit_receiver_wrapper(submit_receiver<Sender, Receiver>* p)
|
||||
: p_(p)
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename... Args>
|
||||
typename enable_if<is_receiver_of<Receiver, Args...>::value>::type
|
||||
set_value(ASIO_MOVE_ARG(Args)... args) ASIO_RVALUE_REF_QUAL
|
||||
ASIO_NOEXCEPT_IF((is_nothrow_receiver_of<Receiver, Args...>::value))
|
||||
{
|
||||
execution::set_value(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(p_->r_),
|
||||
ASIO_MOVE_CAST(Args)(args)...);
|
||||
delete p_;
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
void set_value() ASIO_RVALUE_REF_QUAL
|
||||
ASIO_NOEXCEPT_IF((is_nothrow_receiver_of<Receiver>::value))
|
||||
{
|
||||
execution::set_value(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(p_->r_));
|
||||
delete p_;
|
||||
}
|
||||
|
||||
#define ASIO_PRIVATE_SUBMIT_RECEIVER_SET_VALUE_DEF(n) \
|
||||
template <ASIO_VARIADIC_TPARAMS(n)> \
|
||||
typename enable_if<is_receiver_of<Receiver, \
|
||||
ASIO_VARIADIC_TARGS(n)>::value>::type \
|
||||
set_value(ASIO_VARIADIC_MOVE_PARAMS(n)) ASIO_RVALUE_REF_QUAL \
|
||||
ASIO_NOEXCEPT_IF((is_nothrow_receiver_of< \
|
||||
Receiver, ASIO_VARIADIC_TARGS(n)>::value)) \
|
||||
{ \
|
||||
execution::set_value( \
|
||||
ASIO_MOVE_OR_LVALUE( \
|
||||
typename remove_cvref<Receiver>::type)(p_->r_), \
|
||||
ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
delete p_; \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_SUBMIT_RECEIVER_SET_VALUE_DEF)
|
||||
#undef ASIO_PRIVATE_SUBMIT_RECEIVER_SET_VALUE_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename E>
|
||||
void set_error(ASIO_MOVE_ARG(E) e)
|
||||
ASIO_RVALUE_REF_QUAL ASIO_NOEXCEPT
|
||||
{
|
||||
execution::set_error(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(p_->r_),
|
||||
ASIO_MOVE_CAST(E)(e));
|
||||
delete p_;
|
||||
}
|
||||
|
||||
void set_done() ASIO_RVALUE_REF_QUAL ASIO_NOEXCEPT
|
||||
{
|
||||
execution::set_done(
|
||||
ASIO_MOVE_OR_LVALUE(
|
||||
typename remove_cvref<Receiver>::type)(p_->r_));
|
||||
delete p_;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sender, typename Receiver>
|
||||
struct submit_receiver
|
||||
{
|
||||
typename remove_cvref<Receiver>::type r_;
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
typename connect_result<Sender,
|
||||
submit_receiver_wrapper<Sender, Receiver> >::type state_;
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
typename connect_result<Sender,
|
||||
const submit_receiver_wrapper<Sender, Receiver>& >::type state_;
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename S, typename R>
|
||||
explicit submit_receiver(ASIO_MOVE_ARG(S) s, ASIO_MOVE_ARG(R) r)
|
||||
: r_(ASIO_MOVE_CAST(R)(r)),
|
||||
state_(execution::connect(ASIO_MOVE_CAST(S)(s),
|
||||
submit_receiver_wrapper<Sender, Receiver>(this)))
|
||||
{
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
explicit submit_receiver(Sender s, Receiver r)
|
||||
: r_(r),
|
||||
state_(execution::connect(s,
|
||||
submit_receiver_wrapper<Sender, Receiver>(this)))
|
||||
{
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename Sender, typename Receiver, typename... Args>
|
||||
struct set_value_member<
|
||||
asio::execution::detail::submit_receiver_wrapper<
|
||||
Sender, Receiver>,
|
||||
void(Args...)>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(asio::execution::is_nothrow_receiver_of<Receiver, Args...>::value));
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename Sender, typename Receiver>
|
||||
struct set_value_member<
|
||||
asio::execution::detail::submit_receiver_wrapper<
|
||||
Sender, Receiver>,
|
||||
void()>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
asio::execution::is_nothrow_receiver_of<Receiver>::value);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#define ASIO_PRIVATE_SUBMIT_RECEIVER_TRAIT_DEF(n) \
|
||||
template <typename Sender, typename Receiver, \
|
||||
ASIO_VARIADIC_TPARAMS(n)> \
|
||||
struct set_value_member< \
|
||||
asio::execution::detail::submit_receiver_wrapper< \
|
||||
Sender, Receiver>, \
|
||||
void(ASIO_VARIADIC_TARGS(n))> \
|
||||
{ \
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true); \
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = \
|
||||
(asio::execution::is_nothrow_receiver_of<Receiver, \
|
||||
ASIO_VARIADIC_TARGS(n)>::value)); \
|
||||
typedef void result_type; \
|
||||
}; \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_SUBMIT_RECEIVER_TRAIT_DEF)
|
||||
#undef ASIO_PRIVATE_SUBMIT_RECEIVER_TRAIT_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
template <typename Sender, typename Receiver, typename E>
|
||||
struct set_error_member<
|
||||
asio::execution::detail::submit_receiver_wrapper<
|
||||
Sender, Receiver>, E>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
template <typename Sender, typename Receiver>
|
||||
struct set_done_member<
|
||||
asio::execution::detail::submit_receiver_wrapper<
|
||||
Sender, Receiver> >
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_DETAIL_SUBMIT_RECEIVER_HPP
|
||||
90
extern/asio-1.18.2/include/asio/execution/detail/void_receiver.hpp
vendored
Normal file
90
extern/asio-1.18.2/include/asio/execution/detail/void_receiver.hpp
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// execution/detail/void_receiver.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_DETAIL_VOID_RECEIVER_HPP
|
||||
#define ASIO_EXECUTION_DETAIL_VOID_RECEIVER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/traits/set_done_member.hpp"
|
||||
#include "asio/traits/set_error_member.hpp"
|
||||
#include "asio/traits/set_value_member.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
struct void_receiver
|
||||
{
|
||||
void set_value() ASIO_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
void set_error(ASIO_MOVE_ARG(E)) ASIO_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
void set_done() ASIO_NOEXCEPT
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
template <>
|
||||
struct set_value_member<asio::execution::detail::void_receiver, void()>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
template <typename E>
|
||||
struct set_error_member<asio::execution::detail::void_receiver, E>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
template <>
|
||||
struct set_done_member<asio::execution::detail::void_receiver>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_DETAIL_VOID_RECEIVER_HPP
|
||||
283
extern/asio-1.18.2/include/asio/execution/execute.hpp
vendored
Normal file
283
extern/asio-1.18.2/include/asio/execution/execute.hpp
vendored
Normal file
@@ -0,0 +1,283 @@
|
||||
//
|
||||
// execution/execute.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_EXECUTE_HPP
|
||||
#define ASIO_EXECUTION_EXECUTE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/detail/as_invocable.hpp"
|
||||
#include "asio/execution/detail/as_receiver.hpp"
|
||||
#include "asio/traits/execute_member.hpp"
|
||||
#include "asio/traits/execute_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that executes a function on an executor.
|
||||
/**
|
||||
* The name <tt>execution::execute</tt> denotes a customisation point object.
|
||||
*
|
||||
* For some subexpressions <tt>e</tt> and <tt>f</tt>, let <tt>E</tt> be a type
|
||||
* such that <tt>decltype((e))</tt> is <tt>E</tt> and let <tt>F</tt> be a type
|
||||
* such that <tt>decltype((f))</tt> is <tt>F</tt>. The expression
|
||||
* <tt>execution::execute(e, f)</tt> is ill-formed if <tt>F</tt> does not model
|
||||
* <tt>invocable</tt>, or if <tt>E</tt> does not model either <tt>executor</tt>
|
||||
* or <tt>sender</tt>. Otherwise, it is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>e.execute(f)</tt>, if that expression is valid. If the function
|
||||
* selected does not execute the function object <tt>f</tt> on the executor
|
||||
* <tt>e</tt>, the program is ill-formed with no diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>execute(e, f)</tt>, if that expression is valid, with
|
||||
* overload resolution performed in a context that includes the declaration
|
||||
* <tt>void execute();</tt> and that does not include a declaration of
|
||||
* <tt>execution::execute</tt>. If the function selected by overload
|
||||
* resolution does not execute the function object <tt>f</tt> on the executor
|
||||
* <tt>e</tt>, the program is ill-formed with no diagnostic required.
|
||||
*/
|
||||
inline constexpr unspecified execute = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c execute expression is well-formed.
|
||||
/**
|
||||
* Class template @c can_execute is a trait that is derived from
|
||||
* @c true_type if the expression <tt>execution::execute(std::declval<T>(),
|
||||
* std::declval<F>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename F>
|
||||
struct can_execute :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
template <typename T, typename R>
|
||||
struct is_sender_to;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename S, typename R>
|
||||
void submit_helper(ASIO_MOVE_ARG(S) s, ASIO_MOVE_ARG(R) r);
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
namespace asio_execution_execute_fn {
|
||||
|
||||
using asio::conditional;
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::execution::detail::as_receiver;
|
||||
using asio::execution::detail::is_as_invocable;
|
||||
using asio::execution::is_sender_to;
|
||||
using asio::false_type;
|
||||
using asio::result_of;
|
||||
using asio::traits::execute_free;
|
||||
using asio::traits::execute_member;
|
||||
using asio::true_type;
|
||||
using asio::void_type;
|
||||
|
||||
void execute();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
adapter,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename Impl, typename T, typename F, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
};
|
||||
|
||||
template <typename Impl, typename T, typename F>
|
||||
struct call_traits<Impl, T, void(F),
|
||||
typename enable_if<
|
||||
execute_member<typename Impl::template proxy<T>::type, F>::is_valid
|
||||
>::type> :
|
||||
execute_member<typename Impl::template proxy<T>::type, F>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename Impl, typename T, typename F>
|
||||
struct call_traits<Impl, T, void(F),
|
||||
typename enable_if<
|
||||
!execute_member<typename Impl::template proxy<T>, F>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
execute_free<T, F>::is_valid
|
||||
>::type> :
|
||||
execute_free<T, F>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
template <typename Impl, typename T, typename F>
|
||||
struct call_traits<Impl, T, void(F),
|
||||
typename enable_if<
|
||||
!execute_member<typename Impl::template proxy<T>::type, F>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!execute_free<T, F>::is_valid
|
||||
>::type,
|
||||
typename void_type<
|
||||
typename result_of<typename decay<F>::type&()>::type
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!is_as_invocable<typename decay<F>::type>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender_to<T, as_receiver<typename decay<F>::type, T> >::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = adapter);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
template <typename T>
|
||||
struct proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename F>
|
||||
auto execute(ASIO_MOVE_ARG(F) f)
|
||||
noexcept(
|
||||
noexcept(
|
||||
declval<typename conditional<true, T, F>::type>().execute(
|
||||
ASIO_MOVE_CAST(F)(f))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
declval<typename conditional<true, T, F>::type>().execute(
|
||||
ASIO_MOVE_CAST(F)(f))
|
||||
);
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
|
||||
};
|
||||
|
||||
template <typename T, typename F>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<impl, T, void(F)>::overload == call_member,
|
||||
typename call_traits<impl, T, void(F)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(F) f) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<impl, T, void(F)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(T)(t).execute(ASIO_MOVE_CAST(F)(f));
|
||||
}
|
||||
|
||||
template <typename T, typename F>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<impl, T, void(F)>::overload == call_free,
|
||||
typename call_traits<impl, T, void(F)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(F) f) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<impl, T, void(F)>::is_noexcept))
|
||||
{
|
||||
return execute(ASIO_MOVE_CAST(T)(t), ASIO_MOVE_CAST(F)(f));
|
||||
}
|
||||
|
||||
template <typename T, typename F>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<impl, T, void(F)>::overload == adapter,
|
||||
typename call_traits<impl, T, void(F)>::result_type
|
||||
>::type
|
||||
operator()(
|
||||
ASIO_MOVE_ARG(T) t,
|
||||
ASIO_MOVE_ARG(F) f) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<impl, T, void(F)>::is_noexcept))
|
||||
{
|
||||
return asio::execution::detail::submit_helper(
|
||||
ASIO_MOVE_CAST(T)(t),
|
||||
as_receiver<typename decay<F>::type, T>(
|
||||
ASIO_MOVE_CAST(F)(f), 0));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_execute_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_execute_fn::impl&
|
||||
execute = asio_execution_execute_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
typedef asio_execution_execute_fn::impl execute_t;
|
||||
|
||||
template <typename T, typename F>
|
||||
struct can_execute :
|
||||
integral_constant<bool,
|
||||
asio_execution_execute_fn::call_traits<
|
||||
execute_t, T, void(F)>::overload !=
|
||||
asio_execution_execute_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename F>
|
||||
constexpr bool can_execute_v = can_execute<T, F>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_EXECUTE_HPP
|
||||
252
extern/asio-1.18.2/include/asio/execution/executor.hpp
vendored
Normal file
252
extern/asio-1.18.2/include/asio/execution/executor.hpp
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
//
|
||||
// execution/executor.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_EXECUTOR_HPP
|
||||
#define ASIO_EXECUTION_EXECUTOR_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/execute.hpp"
|
||||
#include "asio/execution/invocable_archetype.hpp"
|
||||
#include "asio/traits/equality_comparable.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_EXECUTE_FREE_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
|
||||
# define ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DEDUCED_EXECUTE_FREE_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename T, typename F,
|
||||
typename = void, typename = void, typename = void, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void>
|
||||
struct is_executor_of_impl : false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename F>
|
||||
struct is_executor_of_impl<T, F,
|
||||
typename enable_if<
|
||||
can_execute<typename add_const<T>::type, F>::value
|
||||
>::type,
|
||||
typename void_type<
|
||||
typename result_of<typename decay<F>::type&()>::type
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_constructible<typename decay<F>::type, F>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_move_constructible<typename decay<F>::type>::value
|
||||
>::type,
|
||||
#if defined(ASIO_HAS_NOEXCEPT)
|
||||
typename enable_if<
|
||||
is_nothrow_copy_constructible<T>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_nothrow_destructible<T>::value
|
||||
>::type,
|
||||
#else // defined(ASIO_HAS_NOEXCEPT)
|
||||
typename enable_if<
|
||||
is_copy_constructible<T>::value
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_destructible<T>::value
|
||||
>::type,
|
||||
#endif // defined(ASIO_HAS_NOEXCEPT)
|
||||
typename enable_if<
|
||||
traits::equality_comparable<T>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
traits::equality_comparable<T>::is_noexcept
|
||||
>::type> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct executor_shape
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct executor_shape<T,
|
||||
typename void_type<
|
||||
typename T::shape_type
|
||||
>::type>
|
||||
{
|
||||
typedef typename T::shape_type type;
|
||||
};
|
||||
|
||||
template <typename T, typename Default, typename = void>
|
||||
struct executor_index
|
||||
{
|
||||
typedef Default type;
|
||||
};
|
||||
|
||||
template <typename T, typename Default>
|
||||
struct executor_index<T, Default,
|
||||
typename void_type<
|
||||
typename T::index_type
|
||||
>::type>
|
||||
{
|
||||
typedef typename T::index_type type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// The is_executor trait detects whether a type T satisfies the
|
||||
/// execution::executor concept.
|
||||
/**
|
||||
* Class template @c is_executor is a UnaryTypeTrait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for an executor,
|
||||
* otherwise @c false_type.
|
||||
*/
|
||||
template <typename T>
|
||||
struct is_executor :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
detail::is_executor_of_impl<T, invocable_archetype>
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONSTEXPR const bool is_executor_v = is_executor<T>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONCEPT executor = is_executor<T>::value;
|
||||
|
||||
#define ASIO_EXECUTION_EXECUTOR ::asio::execution::executor
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_EXECUTOR typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
/// The is_executor_of trait detects whether a type T satisfies the
|
||||
/// execution::executor_of concept for some set of value arguments.
|
||||
/**
|
||||
* Class template @c is_executor_of is a type trait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for an executor
|
||||
* that is invocable with a function object of type @c F, otherwise @c
|
||||
* false_type.
|
||||
*/
|
||||
template <typename T, typename F>
|
||||
struct is_executor_of :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool,
|
||||
is_executor<T>::value && detail::is_executor_of_impl<T, F>::value
|
||||
>
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename F>
|
||||
ASIO_CONSTEXPR const bool is_executor_of_v =
|
||||
is_executor_of<T, F>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T, typename F>
|
||||
ASIO_CONCEPT executor_of = is_executor_of<T, F>::value;
|
||||
|
||||
#define ASIO_EXECUTION_EXECUTOR_OF(f) \
|
||||
::asio::execution::executor_of<f>
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_EXECUTOR_OF typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
/// The executor_shape trait detects the type used by an executor to represent
|
||||
/// the shape of a bulk operation.
|
||||
/**
|
||||
* Class template @c executor_shape is a type trait with a nested type alias
|
||||
* @c type whose type is @c T::shape_type if @c T::shape_type is valid,
|
||||
* otherwise @c std::size_t.
|
||||
*/
|
||||
template <typename T>
|
||||
struct executor_shape
|
||||
#if !defined(GENERATING_DOCUMENTATION)
|
||||
: detail::executor_shape<T>
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
/// @c T::shape_type if @c T::shape_type is valid, otherwise @c std::size_t.
|
||||
typedef automatically_determined type;
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
using executor_shape_t = typename executor_shape<T>::type;
|
||||
|
||||
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
/// The executor_index trait detects the type used by an executor to represent
|
||||
/// an index within a bulk operation.
|
||||
/**
|
||||
* Class template @c executor_index is a type trait with a nested type alias
|
||||
* @c type whose type is @c T::index_type if @c T::index_type is valid,
|
||||
* otherwise @c executor_shape_t<T>.
|
||||
*/
|
||||
template <typename T>
|
||||
struct executor_index
|
||||
#if !defined(GENERATING_DOCUMENTATION)
|
||||
: detail::executor_index<T, typename executor_shape<T>::type>
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
/// @c T::index_type if @c T::index_type is valid, otherwise
|
||||
/// @c executor_shape_t<T>.
|
||||
typedef automatically_determined type;
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
using executor_index_t = typename executor_index<T>::type;
|
||||
|
||||
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_EXECUTOR_HPP
|
||||
40
extern/asio-1.18.2/include/asio/execution/impl/bad_executor.ipp
vendored
Normal file
40
extern/asio-1.18.2/include/asio/execution/impl/bad_executor.ipp
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// exection/impl/bad_executor.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_IMPL_BAD_EXECUTOR_IPP
|
||||
#define ASIO_EXECUTION_IMPL_BAD_EXECUTOR_IPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/execution/bad_executor.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
bad_executor::bad_executor() ASIO_NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char* bad_executor::what() const ASIO_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
return "bad executor";
|
||||
}
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_IMPL_BAD_EXECUTOR_IPP
|
||||
36
extern/asio-1.18.2/include/asio/execution/impl/receiver_invocation_error.ipp
vendored
Normal file
36
extern/asio-1.18.2/include/asio/execution/impl/receiver_invocation_error.ipp
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// exection/impl/receiver_invocation_error.ipp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_IMPL_RECEIVER_INVOCATION_ERROR_IPP
|
||||
#define ASIO_EXECUTION_IMPL_RECEIVER_INVOCATION_ERROR_IPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/execution/receiver_invocation_error.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
receiver_invocation_error::receiver_invocation_error()
|
||||
: std::runtime_error("receiver invocation error")
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_IMPL_RECEIVER_INVOCATION_ERROR_IPP
|
||||
71
extern/asio-1.18.2/include/asio/execution/invocable_archetype.hpp
vendored
Normal file
71
extern/asio-1.18.2/include/asio/execution/invocable_archetype.hpp
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// execution/invocable_archetype.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP
|
||||
#define ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/detail/variadic_templates.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// An archetypal function object used for determining adherence to the
|
||||
/// execution::executor concept.
|
||||
struct invocable_archetype
|
||||
{
|
||||
#if !defined(GENERATING_DOCUMENTATION)
|
||||
// Necessary for compatibility with a C++03 implementation of result_of.
|
||||
typedef void result_type;
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Function call operator.
|
||||
template <typename... Args>
|
||||
void operator()(ASIO_MOVE_ARG(Args)...)
|
||||
{
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
void operator()()
|
||||
{
|
||||
}
|
||||
|
||||
#define ASIO_PRIVATE_INVOCABLE_ARCHETYPE_CALL_DEF(n) \
|
||||
template <ASIO_VARIADIC_TPARAMS(n)> \
|
||||
void operator()(ASIO_VARIADIC_UNNAMED_MOVE_PARAMS(n)) \
|
||||
{ \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_INVOCABLE_ARCHETYPE_CALL_DEF)
|
||||
#undef ASIO_PRIVATE_INVOCABLE_ARCHETYPE_CALL_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP
|
||||
|
||||
1116
extern/asio-1.18.2/include/asio/execution/mapping.hpp
vendored
Normal file
1116
extern/asio-1.18.2/include/asio/execution/mapping.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
226
extern/asio-1.18.2/include/asio/execution/occupancy.hpp
vendored
Normal file
226
extern/asio-1.18.2/include/asio/execution/occupancy.hpp
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// execution/occupancy.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_OCCUPANCY_HPP
|
||||
#define ASIO_EXECUTION_OCCUPANCY_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#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/traits/query_static_constexpr_member.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
/// A property that gives an estimate of the number of execution agents that
|
||||
/// should occupy the associated execution context.
|
||||
struct occupancy_t
|
||||
{
|
||||
/// The occupancy_t property applies to executors, senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The occupancy_t property cannot be required.
|
||||
static constexpr bool is_requirable = false;
|
||||
|
||||
/// The occupancy_t property cannot be preferred.
|
||||
static constexpr bool is_preferable = false;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef std::size_t polymorphic_query_result_type;
|
||||
};
|
||||
|
||||
/// A special value used for accessing the occupancy_t property.
|
||||
constexpr occupancy_t occupancy;
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <int I = 0>
|
||||
struct occupancy_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
|
||||
typedef std::size_t polymorphic_query_result_type;
|
||||
|
||||
ASIO_CONSTEXPR occupancy_t()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct static_proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
static constexpr auto query(ASIO_MOVE_ARG(P) p)
|
||||
noexcept(
|
||||
noexcept(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
{
|
||||
return T::query(ASIO_MOVE_CAST(P)(p));
|
||||
}
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(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, occupancy_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename E, typename T = decltype(occupancy_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= occupancy_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
#if !defined(ASIO_HAS_CONSTEXPR)
|
||||
static const occupancy_t instance;
|
||||
#endif // !defined(ASIO_HAS_CONSTEXPR)
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T occupancy_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 occupancy_t<I> occupancy_t<I>::instance;
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
typedef detail::occupancy_t<> occupancy_t;
|
||||
|
||||
#if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
constexpr occupancy_t occupancy;
|
||||
#else // defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
namespace { static const occupancy_t& occupancy = occupancy_t::instance; }
|
||||
#endif
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::occupancy_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>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
|| !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::occupancy_t,
|
||||
typename enable_if<
|
||||
execution::detail::occupancy_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::occupancy_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::occupancy_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace traits
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_OCCUPANCY_HPP
|
||||
94
extern/asio-1.18.2/include/asio/execution/operation_state.hpp
vendored
Normal file
94
extern/asio-1.18.2/include/asio/execution/operation_state.hpp
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// execution/operation_state.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_OPERATION_STATE_HPP
|
||||
#define ASIO_EXECUTION_OPERATION_STATE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/start.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_START_FREE_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
|
||||
# define ASIO_HAS_DEDUCED_EXECUTION_IS_OPERATION_STATE_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DEDUCED_START_FREE_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_START_MEMBER_TRAIT)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct is_operation_state_base :
|
||||
integral_constant<bool,
|
||||
is_destructible<T>::value
|
||||
&& is_object<T>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// The is_operation_state trait detects whether a type T satisfies the
|
||||
/// execution::operation_state concept.
|
||||
/**
|
||||
* Class template @c is_operation_state is a type trait that is derived from
|
||||
* @c true_type if the type @c T meets the concept definition for an
|
||||
* @c operation_state, otherwise @c false_type.
|
||||
*/
|
||||
template <typename T>
|
||||
struct is_operation_state :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
conditional<
|
||||
can_start<typename add_lvalue_reference<T>::type>::value
|
||||
&& is_nothrow_start<typename add_lvalue_reference<T>::type>::value,
|
||||
detail::is_operation_state_base<T>,
|
||||
false_type
|
||||
>::type
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONSTEXPR const bool is_operation_state_v =
|
||||
is_operation_state<T>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONCEPT operation_state = is_operation_state<T>::value;
|
||||
|
||||
#define ASIO_EXECUTION_OPERATION_STATE \
|
||||
::asio::execution::operation_state
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_OPERATION_STATE typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_OPERATION_STATE_HPP
|
||||
867
extern/asio-1.18.2/include/asio/execution/outstanding_work.hpp
vendored
Normal file
867
extern/asio-1.18.2/include/asio/execution/outstanding_work.hpp
vendored
Normal file
@@ -0,0 +1,867 @@
|
||||
//
|
||||
// execution/outstanding_work.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_OUTSTANDING_WORK_HPP
|
||||
#define ASIO_EXECUTION_OUTSTANDING_WORK_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#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"
|
||||
#include "asio/traits/query_member.hpp"
|
||||
#include "asio/traits/query_static_constexpr_member.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
#include "asio/traits/static_require.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
/// A property to describe whether task submission is likely in the future.
|
||||
struct outstanding_work_t
|
||||
{
|
||||
/// The outstanding_work_t property applies to executors, senders, and
|
||||
/// schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The top-level outstanding_work_t property cannot be required.
|
||||
static constexpr bool is_requirable = false;
|
||||
|
||||
/// The top-level outstanding_work_t property cannot be preferred.
|
||||
static constexpr bool is_preferable = false;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef outstanding_work_t polymorphic_query_result_type;
|
||||
|
||||
/// A sub-property that indicates that the executor does not represent likely
|
||||
/// future submission of a function object.
|
||||
struct untracked_t
|
||||
{
|
||||
/// The outstanding_work_t::untracked_t property applies to executors,
|
||||
/// senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The outstanding_work_t::untracked_t property can be required.
|
||||
static constexpr bool is_requirable = true;
|
||||
|
||||
/// The outstanding_work_t::untracked_t property can be preferred.
|
||||
static constexpr bool is_preferable = true;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef outstanding_work_t polymorphic_query_result_type;
|
||||
|
||||
/// Default constructor.
|
||||
constexpr untracked_t();
|
||||
|
||||
/// Get the value associated with a property object.
|
||||
/**
|
||||
* @returns untracked_t();
|
||||
*/
|
||||
static constexpr outstanding_work_t value();
|
||||
};
|
||||
|
||||
/// A sub-property that indicates that the executor represents likely
|
||||
/// future submission of a function object.
|
||||
struct tracked_t
|
||||
{
|
||||
/// The outstanding_work_t::untracked_t property applies to executors,
|
||||
/// senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The outstanding_work_t::tracked_t property can be required.
|
||||
static constexpr bool is_requirable = true;
|
||||
|
||||
/// The outstanding_work_t::tracked_t property can be preferred.
|
||||
static constexpr bool is_preferable = true;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef outstanding_work_t polymorphic_query_result_type;
|
||||
|
||||
/// Default constructor.
|
||||
constexpr tracked_t();
|
||||
|
||||
/// Get the value associated with a property object.
|
||||
/**
|
||||
* @returns tracked_t();
|
||||
*/
|
||||
static constexpr outstanding_work_t value();
|
||||
};
|
||||
|
||||
/// A special value used for accessing the outstanding_work_t::untracked_t
|
||||
/// property.
|
||||
static constexpr untracked_t untracked;
|
||||
|
||||
/// A special value used for accessing the outstanding_work_t::tracked_t
|
||||
/// property.
|
||||
static constexpr tracked_t tracked;
|
||||
|
||||
/// Default constructor.
|
||||
constexpr outstanding_work_t();
|
||||
|
||||
/// Construct from a sub-property value.
|
||||
constexpr outstanding_work_t(untracked_t);
|
||||
|
||||
/// Construct from a sub-property value.
|
||||
constexpr outstanding_work_t(tracked_t);
|
||||
|
||||
/// Compare property values for equality.
|
||||
friend constexpr bool operator==(
|
||||
const outstanding_work_t& a, const outstanding_work_t& b) noexcept;
|
||||
|
||||
/// Compare property values for inequality.
|
||||
friend constexpr bool operator!=(
|
||||
const outstanding_work_t& a, const outstanding_work_t& b) noexcept;
|
||||
};
|
||||
|
||||
/// A special value used for accessing the outstanding_work_t property.
|
||||
constexpr outstanding_work_t outstanding_work;
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
namespace outstanding_work {
|
||||
|
||||
template <int I> struct untracked_t;
|
||||
template <int I> struct tracked_t;
|
||||
|
||||
} // namespace outstanding_work
|
||||
|
||||
template <int I = 0>
|
||||
struct outstanding_work_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
|
||||
typedef outstanding_work_t polymorphic_query_result_type;
|
||||
|
||||
typedef detail::outstanding_work::untracked_t<I> untracked_t;
|
||||
typedef detail::outstanding_work::tracked_t<I> tracked_t;
|
||||
|
||||
ASIO_CONSTEXPR outstanding_work_t()
|
||||
: value_(-1)
|
||||
{
|
||||
}
|
||||
|
||||
ASIO_CONSTEXPR outstanding_work_t(untracked_t)
|
||||
: value_(0)
|
||||
{
|
||||
}
|
||||
|
||||
ASIO_CONSTEXPR outstanding_work_t(tracked_t)
|
||||
: value_(1)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
auto query(ASIO_MOVE_ARG(P) p) const
|
||||
noexcept(
|
||||
noexcept(
|
||||
declval<typename conditional<true, T, P>::type>().query(
|
||||
ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
declval<typename conditional<true, T, P>::type>().query(
|
||||
ASIO_MOVE_CAST(P)(p))
|
||||
);
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
static constexpr auto query(ASIO_MOVE_ARG(P) p)
|
||||
noexcept(
|
||||
noexcept(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
{
|
||||
return T::query(ASIO_MOVE_CAST(P)(p));
|
||||
}
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct query_member :
|
||||
traits::query_member<typename proxy<T>::type, outstanding_work_t> {};
|
||||
|
||||
template <typename T>
|
||||
struct query_static_constexpr_member :
|
||||
traits::query_static_constexpr_member<
|
||||
typename static_proxy<T>::type, outstanding_work_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static ASIO_CONSTEXPR
|
||||
typename traits::static_query<T, untracked_t>::result_type
|
||||
static_query(
|
||||
typename enable_if<
|
||||
!query_static_constexpr_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!query_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
traits::static_query<T, untracked_t>::is_valid
|
||||
>::type* = 0) ASIO_NOEXCEPT
|
||||
{
|
||||
return traits::static_query<T, untracked_t>::value();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static ASIO_CONSTEXPR
|
||||
typename traits::static_query<T, tracked_t>::result_type
|
||||
static_query(
|
||||
typename enable_if<
|
||||
!query_static_constexpr_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!query_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!traits::static_query<T, untracked_t>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
traits::static_query<T, tracked_t>::is_valid
|
||||
>::type* = 0) ASIO_NOEXCEPT
|
||||
{
|
||||
return traits::static_query<T, tracked_t>::value();
|
||||
}
|
||||
|
||||
template <typename E,
|
||||
typename T = decltype(outstanding_work_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= outstanding_work_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator==(
|
||||
const outstanding_work_t& a, const outstanding_work_t& b)
|
||||
{
|
||||
return a.value_ == b.value_;
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator!=(
|
||||
const outstanding_work_t& a, const outstanding_work_t& b)
|
||||
{
|
||||
return a.value_ != b.value_;
|
||||
}
|
||||
|
||||
struct convertible_from_outstanding_work_t
|
||||
{
|
||||
ASIO_CONSTEXPR convertible_from_outstanding_work_t(outstanding_work_t)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Executor>
|
||||
friend ASIO_CONSTEXPR outstanding_work_t query(
|
||||
const Executor& ex, convertible_from_outstanding_work_t,
|
||||
typename enable_if<
|
||||
can_query<const Executor&, untracked_t>::value
|
||||
>::type* = 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&,
|
||||
outstanding_work_t<>::untracked_t>::value))
|
||||
#else // defined(ASIO_MSVC)
|
||||
ASIO_NOEXCEPT_IF((
|
||||
is_nothrow_query<const Executor&, untracked_t>::value))
|
||||
#endif // defined(ASIO_MSVC)
|
||||
#endif // !defined(__clang__)
|
||||
{
|
||||
return asio::query(ex, untracked_t());
|
||||
}
|
||||
|
||||
template <typename Executor>
|
||||
friend ASIO_CONSTEXPR outstanding_work_t query(
|
||||
const Executor& ex, convertible_from_outstanding_work_t,
|
||||
typename enable_if<
|
||||
!can_query<const Executor&, untracked_t>::value
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
can_query<const Executor&, tracked_t>::value
|
||||
>::type* = 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&,
|
||||
outstanding_work_t<>::tracked_t>::value))
|
||||
#else // defined(ASIO_MSVC)
|
||||
ASIO_NOEXCEPT_IF((
|
||||
is_nothrow_query<const Executor&, tracked_t>::value))
|
||||
#endif // defined(ASIO_MSVC)
|
||||
#endif // !defined(__clang__)
|
||||
{
|
||||
return asio::query(ex, tracked_t());
|
||||
}
|
||||
|
||||
ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(untracked_t, untracked);
|
||||
ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(tracked_t, tracked);
|
||||
|
||||
#if !defined(ASIO_HAS_CONSTEXPR)
|
||||
static const outstanding_work_t instance;
|
||||
#endif // !defined(ASIO_HAS_CONSTEXPR)
|
||||
|
||||
private:
|
||||
int value_;
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T outstanding_work_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 outstanding_work_t<I> outstanding_work_t<I>::instance;
|
||||
#endif
|
||||
|
||||
template <int I>
|
||||
const typename outstanding_work_t<I>::untracked_t
|
||||
outstanding_work_t<I>::untracked;
|
||||
|
||||
template <int I>
|
||||
const typename outstanding_work_t<I>::tracked_t
|
||||
outstanding_work_t<I>::tracked;
|
||||
|
||||
namespace outstanding_work {
|
||||
|
||||
template <int I = 0>
|
||||
struct untracked_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
|
||||
typedef outstanding_work_t<I> polymorphic_query_result_type;
|
||||
|
||||
ASIO_CONSTEXPR untracked_t()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct query_member :
|
||||
traits::query_member<
|
||||
typename outstanding_work_t<I>::template proxy<T>::type, untracked_t> {};
|
||||
|
||||
template <typename T>
|
||||
struct query_static_constexpr_member :
|
||||
traits::query_static_constexpr_member<
|
||||
typename outstanding_work_t<I>::template static_proxy<T>::type,
|
||||
untracked_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static ASIO_CONSTEXPR untracked_t static_query(
|
||||
typename enable_if<
|
||||
!query_static_constexpr_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!query_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!traits::query_free<T, untracked_t>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!can_query<T, tracked_t<I> >::value
|
||||
>::type* = 0) ASIO_NOEXCEPT
|
||||
{
|
||||
return untracked_t();
|
||||
}
|
||||
|
||||
template <typename E, typename T = decltype(untracked_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= untracked_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
static ASIO_CONSTEXPR outstanding_work_t<I> value()
|
||||
{
|
||||
return untracked_t();
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator==(
|
||||
const untracked_t&, const untracked_t&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator!=(
|
||||
const untracked_t&, const untracked_t&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T untracked_t<I>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <int I = 0>
|
||||
struct tracked_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
|
||||
typedef outstanding_work_t<I> polymorphic_query_result_type;
|
||||
|
||||
ASIO_CONSTEXPR tracked_t()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct query_member :
|
||||
traits::query_member<
|
||||
typename outstanding_work_t<I>::template proxy<T>::type, tracked_t> {};
|
||||
|
||||
template <typename T>
|
||||
struct query_static_constexpr_member :
|
||||
traits::query_static_constexpr_member<
|
||||
typename outstanding_work_t<I>::template static_proxy<T>::type,
|
||||
tracked_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename E, typename T = decltype(tracked_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= tracked_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
static ASIO_CONSTEXPR outstanding_work_t<I> value()
|
||||
{
|
||||
return tracked_t();
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator==(
|
||||
const tracked_t&, const tracked_t&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator!=(
|
||||
const tracked_t&, const tracked_t&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T tracked_t<I>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace outstanding_work
|
||||
} // namespace detail
|
||||
|
||||
typedef detail::outstanding_work_t<> outstanding_work_t;
|
||||
|
||||
#if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
constexpr outstanding_work_t outstanding_work;
|
||||
#else // defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
namespace { static const outstanding_work_t&
|
||||
outstanding_work = outstanding_work_t::instance; }
|
||||
#endif
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::outstanding_work_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>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::outstanding_work_t::untracked_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>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::outstanding_work_t::tracked_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>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
template <typename T>
|
||||
struct query_free_default<T, execution::outstanding_work_t,
|
||||
typename enable_if<
|
||||
can_query<T, execution::outstanding_work_t::untracked_t>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(is_nothrow_query<T, execution::outstanding_work_t::untracked_t>::value));
|
||||
|
||||
typedef execution::outstanding_work_t result_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct query_free_default<T, execution::outstanding_work_t,
|
||||
typename enable_if<
|
||||
!can_query<T, execution::outstanding_work_t::untracked_t>::value
|
||||
&& can_query<T, execution::outstanding_work_t::tracked_t>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(is_nothrow_query<T, execution::outstanding_work_t::tracked_t>::value));
|
||||
|
||||
typedef execution::outstanding_work_t result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
|| !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::outstanding_work_t,
|
||||
typename enable_if<
|
||||
execution::detail::outstanding_work_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::outstanding_work_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::outstanding_work_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::outstanding_work_t,
|
||||
typename enable_if<
|
||||
!execution::detail::outstanding_work_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
&& !execution::detail::outstanding_work_t<0>::
|
||||
query_member<T>::is_valid
|
||||
&& traits::static_query<T,
|
||||
execution::outstanding_work_t::untracked_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename traits::static_query<T,
|
||||
execution::outstanding_work_t::untracked_t>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return traits::static_query<T,
|
||||
execution::outstanding_work_t::untracked_t>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::outstanding_work_t,
|
||||
typename enable_if<
|
||||
!execution::detail::outstanding_work_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
&& !execution::detail::outstanding_work_t<0>::
|
||||
query_member<T>::is_valid
|
||||
&& !traits::static_query<T,
|
||||
execution::outstanding_work_t::untracked_t>::is_valid
|
||||
&& traits::static_query<T,
|
||||
execution::outstanding_work_t::tracked_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename traits::static_query<T,
|
||||
execution::outstanding_work_t::tracked_t>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return traits::static_query<T,
|
||||
execution::outstanding_work_t::tracked_t>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::outstanding_work_t::untracked_t,
|
||||
typename enable_if<
|
||||
execution::detail::outstanding_work::untracked_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::outstanding_work::untracked_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::outstanding_work::untracked_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::outstanding_work_t::untracked_t,
|
||||
typename enable_if<
|
||||
!execution::detail::outstanding_work::untracked_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
&& !execution::detail::outstanding_work::untracked_t<0>::
|
||||
query_member<T>::is_valid
|
||||
&& !traits::query_free<T,
|
||||
execution::outstanding_work_t::untracked_t>::is_valid
|
||||
&& !can_query<T, execution::outstanding_work_t::tracked_t>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef execution::outstanding_work_t::untracked_t result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::outstanding_work_t::tracked_t,
|
||||
typename enable_if<
|
||||
execution::detail::outstanding_work::tracked_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::outstanding_work::tracked_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::outstanding_work::tracked_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
#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::outstanding_work_t::untracked_t,
|
||||
typename enable_if<
|
||||
static_query<T, execution::outstanding_work_t::untracked_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid =
|
||||
(is_same<typename static_query<T,
|
||||
execution::outstanding_work_t::untracked_t>::result_type,
|
||||
execution::outstanding_work_t::untracked_t>::value));
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_require<T, execution::outstanding_work_t::tracked_t,
|
||||
typename enable_if<
|
||||
static_query<T, execution::outstanding_work_t::tracked_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid =
|
||||
(is_same<typename static_query<T,
|
||||
execution::outstanding_work_t::tracked_t>::result_type,
|
||||
execution::outstanding_work_t::tracked_t>::value));
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_OUTSTANDING_WORK_HPP
|
||||
331
extern/asio-1.18.2/include/asio/execution/prefer_only.hpp
vendored
Normal file
331
extern/asio-1.18.2/include/asio/execution/prefer_only.hpp
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
//
|
||||
// execution/prefer_only.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_PREFER_ONLY_HPP
|
||||
#define ASIO_EXECUTION_PREFER_ONLY_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/is_applicable_property.hpp"
|
||||
#include "asio/prefer.hpp"
|
||||
#include "asio/query.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
/// A property adapter that is used with the polymorphic executor wrapper
|
||||
/// to mark properties as preferable, but not requirable.
|
||||
template <typename Property>
|
||||
struct prefer_only
|
||||
{
|
||||
/// The prefer_only adapter applies to the same types as the nested property.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_applicable_property<T, Property>::value;
|
||||
|
||||
/// The context_t property cannot be required.
|
||||
static constexpr bool is_requirable = false;
|
||||
|
||||
/// The context_t property can be preferred, it the underlying property can
|
||||
/// be preferred.
|
||||
/**
|
||||
* @c true if @c Property::is_preferable is @c true, otherwise @c false.
|
||||
*/
|
||||
static constexpr bool is_preferable = automatically_determined;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef typename Property::polymorphic_query_result_type
|
||||
polymorphic_query_result_type;
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename InnerProperty, typename = void>
|
||||
struct prefer_only_is_preferable
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
|
||||
};
|
||||
|
||||
template <typename InnerProperty>
|
||||
struct prefer_only_is_preferable<InnerProperty,
|
||||
typename enable_if<
|
||||
InnerProperty::is_preferable
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
|
||||
};
|
||||
|
||||
template <typename InnerProperty, typename = void>
|
||||
struct prefer_only_polymorphic_query_result_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename InnerProperty>
|
||||
struct prefer_only_polymorphic_query_result_type<InnerProperty,
|
||||
typename void_type<
|
||||
typename InnerProperty::polymorphic_query_result_type
|
||||
>::type>
|
||||
{
|
||||
typedef typename InnerProperty::polymorphic_query_result_type
|
||||
polymorphic_query_result_type;
|
||||
};
|
||||
|
||||
template <typename InnerProperty, typename = void>
|
||||
struct prefer_only_property
|
||||
{
|
||||
InnerProperty property;
|
||||
|
||||
prefer_only_property(const InnerProperty& p)
|
||||
: property(p)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DECLTYPE) \
|
||||
&& defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
template <typename InnerProperty>
|
||||
struct prefer_only_property<InnerProperty,
|
||||
typename void_type<
|
||||
decltype(asio::declval<const InnerProperty>().value())
|
||||
>::type>
|
||||
{
|
||||
InnerProperty property;
|
||||
|
||||
prefer_only_property(const InnerProperty& p)
|
||||
: property(p)
|
||||
{
|
||||
}
|
||||
|
||||
ASIO_CONSTEXPR auto value() const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
noexcept(asio::declval<const InnerProperty>().value())))
|
||||
-> decltype(asio::declval<const InnerProperty>().value())
|
||||
{
|
||||
return property.value();
|
||||
}
|
||||
};
|
||||
|
||||
#else // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
struct prefer_only_memfns_base
|
||||
{
|
||||
void value();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct prefer_only_memfns_derived
|
||||
: T, prefer_only_memfns_base
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, T>
|
||||
struct prefer_only_memfns_check
|
||||
{
|
||||
};
|
||||
|
||||
template <typename>
|
||||
char (&prefer_only_value_memfn_helper(...))[2];
|
||||
|
||||
template <typename T>
|
||||
char prefer_only_value_memfn_helper(
|
||||
prefer_only_memfns_check<
|
||||
void (prefer_only_memfns_base::*)(),
|
||||
&prefer_only_memfns_derived<T>::value>*);
|
||||
|
||||
template <typename InnerProperty>
|
||||
struct prefer_only_property<InnerProperty,
|
||||
typename enable_if<
|
||||
sizeof(prefer_only_value_memfn_helper<InnerProperty>(0)) != 1
|
||||
&& !is_same<typename InnerProperty::polymorphic_query_result_type,
|
||||
void>::value
|
||||
>::type>
|
||||
{
|
||||
InnerProperty property;
|
||||
|
||||
prefer_only_property(const InnerProperty& p)
|
||||
: property(p)
|
||||
{
|
||||
}
|
||||
|
||||
ASIO_CONSTEXPR typename InnerProperty::polymorphic_query_result_type
|
||||
value() const
|
||||
{
|
||||
return property.value();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DECLTYPE)
|
||||
// && defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename InnerProperty>
|
||||
struct prefer_only :
|
||||
detail::prefer_only_is_preferable<InnerProperty>,
|
||||
detail::prefer_only_polymorphic_query_result_type<InnerProperty>,
|
||||
detail::prefer_only_property<InnerProperty>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
|
||||
|
||||
ASIO_CONSTEXPR prefer_only(const InnerProperty& p)
|
||||
: detail::prefer_only_property<InnerProperty>(p)
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <typename T>
|
||||
static ASIO_CONSTEXPR
|
||||
typename traits::static_query<T, InnerProperty>::result_type
|
||||
static_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
traits::static_query<T, InnerProperty>::is_noexcept))
|
||||
{
|
||||
return traits::static_query<T, InnerProperty>::value();
|
||||
}
|
||||
|
||||
template <typename E, typename T = decltype(prefer_only::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= prefer_only::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename Executor, typename Property>
|
||||
friend ASIO_CONSTEXPR
|
||||
typename prefer_result<const Executor&, const InnerProperty&>::type
|
||||
prefer(const Executor& ex, const prefer_only<Property>& p,
|
||||
typename enable_if<
|
||||
is_same<Property, InnerProperty>::value
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
can_prefer<const Executor&, const InnerProperty&>::value
|
||||
>::type* = 0)
|
||||
#if !defined(ASIO_MSVC) \
|
||||
&& !defined(__clang__) // Clang crashes if noexcept is used here.
|
||||
ASIO_NOEXCEPT_IF((
|
||||
is_nothrow_prefer<const Executor&, const InnerProperty&>::value))
|
||||
#endif // !defined(ASIO_MSVC)
|
||||
// && !defined(__clang__)
|
||||
{
|
||||
return asio::prefer(ex, p.property);
|
||||
}
|
||||
|
||||
template <typename Executor, typename Property>
|
||||
friend ASIO_CONSTEXPR
|
||||
typename query_result<const Executor&, const InnerProperty&>::type
|
||||
query(const Executor& ex, const prefer_only<Property>& p,
|
||||
typename enable_if<
|
||||
is_same<Property, InnerProperty>::value
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
can_query<const Executor&, const InnerProperty&>::value
|
||||
>::type* = 0)
|
||||
#if !defined(ASIO_MSVC) \
|
||||
&& !defined(__clang__) // Clang crashes if noexcept is used here.
|
||||
ASIO_NOEXCEPT_IF((
|
||||
is_nothrow_query<const Executor&, const InnerProperty&>::value))
|
||||
#endif // !defined(ASIO_MSVC)
|
||||
// && !defined(__clang__)
|
||||
{
|
||||
return asio::query(ex, p.property);
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <typename InnerProperty> template <typename E, typename T>
|
||||
const T prefer_only<InnerProperty>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
|
||||
template <typename T, typename InnerProperty>
|
||||
struct is_applicable_property<T, execution::prefer_only<InnerProperty> >
|
||||
: is_applicable_property<T, InnerProperty>
|
||||
{
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
|| !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename InnerProperty>
|
||||
struct static_query<T, execution::prefer_only<InnerProperty> > :
|
||||
static_query<T, const InnerProperty&>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename InnerProperty>
|
||||
struct prefer_free_default<T, execution::prefer_only<InnerProperty>,
|
||||
typename enable_if<
|
||||
can_prefer<const T&, const InnerProperty&>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(is_nothrow_prefer<const T&, const InnerProperty&>::value));
|
||||
|
||||
typedef typename prefer_result<const T&,
|
||||
const InnerProperty&>::type result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
template <typename T, typename InnerProperty>
|
||||
struct query_free<T, execution::prefer_only<InnerProperty>,
|
||||
typename enable_if<
|
||||
can_query<const T&, const InnerProperty&>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(is_nothrow_query<const T&, const InnerProperty&>::value));
|
||||
|
||||
typedef typename query_result<const T&,
|
||||
const InnerProperty&>::type result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_PREFER_ONLY_HPP
|
||||
280
extern/asio-1.18.2/include/asio/execution/receiver.hpp
vendored
Normal file
280
extern/asio-1.18.2/include/asio/execution/receiver.hpp
vendored
Normal file
@@ -0,0 +1,280 @@
|
||||
//
|
||||
// execution/receiver.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_RECEIVER_HPP
|
||||
#define ASIO_EXECUTION_RECEIVER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/detail/variadic_templates.hpp"
|
||||
#include "asio/execution/set_done.hpp"
|
||||
#include "asio/execution/set_error.hpp"
|
||||
#include "asio/execution/set_value.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
# include <exception>
|
||||
#else // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
# include "asio/error_code.hpp"
|
||||
#endif // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_SET_DONE_FREE_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_SET_ERROR_FREE_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_RECEIVER_OF_FREE_TRAIT) \
|
||||
&& defined(ASIO_HAS_DEDUCED_RECEIVER_OF_MEMBER_TRAIT)
|
||||
# define ASIO_HAS_DEDUCED_EXECUTION_IS_RECEIVER_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_DEDUCED_SET_DONE_FREE_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_SET_ERROR_FREE_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_RECEIVER_OF_FREE_TRAIT)
|
||||
// && defined(ASIO_HAS_DEDUCED_RECEIVER_OF_MEMBER_TRAIT)
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename T, typename E>
|
||||
struct is_receiver_base :
|
||||
integral_constant<bool,
|
||||
is_move_constructible<typename remove_cvref<T>::type>::value
|
||||
&& is_constructible<typename remove_cvref<T>::type, T>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#if defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
# define ASIO_EXECUTION_RECEIVER_ERROR_DEFAULT = std::exception_ptr
|
||||
#else // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
# define ASIO_EXECUTION_RECEIVER_ERROR_DEFAULT \
|
||||
= ::asio::error_code
|
||||
#endif // defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
|
||||
/// The is_receiver trait detects whether a type T satisfies the
|
||||
/// execution::receiver concept.
|
||||
/**
|
||||
* Class template @c is_receiver is a type trait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for a receiver for
|
||||
* error type @c E, otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename E ASIO_EXECUTION_RECEIVER_ERROR_DEFAULT>
|
||||
struct is_receiver :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
conditional<
|
||||
can_set_done<typename remove_cvref<T>::type>::value
|
||||
&& is_nothrow_set_done<typename remove_cvref<T>::type>::value
|
||||
&& can_set_error<typename remove_cvref<T>::type, E>::value
|
||||
&& is_nothrow_set_error<typename remove_cvref<T>::type, E>::value,
|
||||
detail::is_receiver_base<T, E>,
|
||||
false_type
|
||||
>::type
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename E ASIO_EXECUTION_RECEIVER_ERROR_DEFAULT>
|
||||
ASIO_CONSTEXPR const bool is_receiver_v = is_receiver<T, E>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T, typename E ASIO_EXECUTION_RECEIVER_ERROR_DEFAULT>
|
||||
ASIO_CONCEPT receiver = is_receiver<T, E>::value;
|
||||
|
||||
#define ASIO_EXECUTION_RECEIVER ::asio::execution::receiver
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_RECEIVER typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// The is_receiver_of trait detects whether a type T satisfies the
|
||||
/// execution::receiver_of concept for some set of value arguments.
|
||||
/**
|
||||
* Class template @c is_receiver_of is a type trait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for a receiver for
|
||||
* value arguments @c Vs, otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename... Vs>
|
||||
struct is_receiver_of :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
conditional<
|
||||
is_receiver<T>::value,
|
||||
can_set_value<typename remove_cvref<T>::type, Vs...>,
|
||||
false_type
|
||||
>::type
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Vs>
|
||||
ASIO_CONSTEXPR const bool is_receiver_of_v =
|
||||
is_receiver_of<T, Vs...>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T, typename... Vs>
|
||||
ASIO_CONCEPT receiver_of = is_receiver_of<T, Vs...>::value;
|
||||
|
||||
#define ASIO_EXECUTION_RECEIVER_OF_0 \
|
||||
::asio::execution::receiver_of
|
||||
|
||||
#define ASIO_EXECUTION_RECEIVER_OF_1(v) \
|
||||
::asio::execution::receiver_of<v>
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_RECEIVER_OF_0 typename
|
||||
#define ASIO_EXECUTION_RECEIVER_OF_1(v) typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename T, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void>
|
||||
struct is_receiver_of;
|
||||
|
||||
template <typename T>
|
||||
struct is_receiver_of<T> :
|
||||
conditional<
|
||||
is_receiver<T>::value,
|
||||
can_set_value<typename remove_cvref<T>::type>,
|
||||
false_type
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#define ASIO_PRIVATE_RECEIVER_OF_TRAITS_DEF(n) \
|
||||
template <typename T, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
struct is_receiver_of<T, ASIO_VARIADIC_TARGS(n)> : \
|
||||
conditional< \
|
||||
conditional<true, is_receiver<T>, void>::type::value, \
|
||||
can_set_value< \
|
||||
typename remove_cvref<T>::type, \
|
||||
ASIO_VARIADIC_TARGS(n)>, \
|
||||
false_type \
|
||||
>::type \
|
||||
{ \
|
||||
}; \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_RECEIVER_OF_TRAITS_DEF)
|
||||
#undef ASIO_PRIVATE_RECEIVER_OF_TRAITS_DEF
|
||||
|
||||
#define ASIO_EXECUTION_RECEIVER_OF_0 typename
|
||||
#define ASIO_EXECUTION_RECEIVER_OF_1(v) typename
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// The is_nothrow_receiver_of trait detects whether a type T satisfies the
|
||||
/// execution::receiver_of concept for some set of value arguments, with a
|
||||
/// noexcept @c set_value operation.
|
||||
/**
|
||||
* Class template @c is_nothrow_receiver_of is a type trait that is derived
|
||||
* from @c true_type if the type @c T meets the concept definition for a
|
||||
* receiver for value arguments @c Vs, and the expression
|
||||
* <tt>execution::set_value(declval<T>(), declval<Ts>()...)</tt> is noexcept,
|
||||
* otherwise @c false_type.
|
||||
*/
|
||||
template <typename T, typename... Vs>
|
||||
struct is_nothrow_receiver_of :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool,
|
||||
is_receiver_of<T, Vs...>::value
|
||||
&& is_nothrow_set_value<typename remove_cvref<T>::type, Vs...>::value
|
||||
>
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename... Vs>
|
||||
ASIO_CONSTEXPR const bool is_nothrow_receiver_of_v =
|
||||
is_nothrow_receiver_of<T, Vs...>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
template <typename T, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void>
|
||||
struct is_nothrow_receiver_of;
|
||||
|
||||
template <typename T>
|
||||
struct is_nothrow_receiver_of<T> :
|
||||
integral_constant<bool,
|
||||
is_receiver_of<T>::value
|
||||
&& is_nothrow_set_value<typename remove_cvref<T>::type>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
#define ASIO_PRIVATE_NOTHROW_RECEIVER_OF_TRAITS_DEF(n) \
|
||||
template <typename T, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
struct is_nothrow_receiver_of<T, ASIO_VARIADIC_TARGS(n)> : \
|
||||
integral_constant<bool, \
|
||||
is_receiver_of<T, ASIO_VARIADIC_TARGS(n)>::value \
|
||||
&& is_nothrow_set_value<typename remove_cvref<T>::type, \
|
||||
ASIO_VARIADIC_TARGS(n)>::value \
|
||||
> \
|
||||
{ \
|
||||
}; \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_NOTHROW_RECEIVER_OF_TRAITS_DEF)
|
||||
#undef ASIO_PRIVATE_NOTHROW_RECEIVER_OF_TRAITS_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_RECEIVER_HPP
|
||||
48
extern/asio-1.18.2/include/asio/execution/receiver_invocation_error.hpp
vendored
Normal file
48
extern/asio-1.18.2/include/asio/execution/receiver_invocation_error.hpp
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// execution/receiver_invocation_error.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_RECEIVER_INVOCATION_ERROR_HPP
|
||||
#define ASIO_EXECUTION_RECEIVER_INVOCATION_ERROR_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// Exception reported via @c set_error when an exception escapes from
|
||||
/// @c set_value.
|
||||
class receiver_invocation_error
|
||||
: public std::runtime_error
|
||||
#if defined(ASIO_HAS_STD_NESTED_EXCEPTION)
|
||||
, public std::nested_exception
|
||||
#endif // defined(ASIO_HAS_STD_NESTED_EXCEPTION)
|
||||
{
|
||||
public:
|
||||
/// Constructor.
|
||||
ASIO_DECL receiver_invocation_error();
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#if defined(ASIO_HEADER_ONLY)
|
||||
# include "asio/execution/impl/receiver_invocation_error.ipp"
|
||||
#endif // defined(ASIO_HEADER_ONLY)
|
||||
|
||||
#endif // ASIO_EXECUTION_RECEIVER_INVOCATION_ERROR_HPP
|
||||
865
extern/asio-1.18.2/include/asio/execution/relationship.hpp
vendored
Normal file
865
extern/asio-1.18.2/include/asio/execution/relationship.hpp
vendored
Normal file
@@ -0,0 +1,865 @@
|
||||
//
|
||||
// execution/relationship.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_RELATIONSHIP_HPP
|
||||
#define ASIO_EXECUTION_RELATIONSHIP_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#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"
|
||||
#include "asio/traits/query_member.hpp"
|
||||
#include "asio/traits/query_static_constexpr_member.hpp"
|
||||
#include "asio/traits/static_query.hpp"
|
||||
#include "asio/traits/static_require.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
|
||||
/// A property to describe whether submitted tasks represent continuations of
|
||||
/// the calling context.
|
||||
struct relationship_t
|
||||
{
|
||||
/// The relationship_t property applies to executors, senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The top-level relationship_t property cannot be required.
|
||||
static constexpr bool is_requirable = false;
|
||||
|
||||
/// The top-level relationship_t property cannot be preferred.
|
||||
static constexpr bool is_preferable = false;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef relationship_t polymorphic_query_result_type;
|
||||
|
||||
/// A sub-property that indicates that the executor does not represent a
|
||||
/// continuation of the calling context.
|
||||
struct fork_t
|
||||
{
|
||||
/// The relationship_t::fork_t property applies to executors, senders, and
|
||||
/// schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The relationship_t::fork_t property can be required.
|
||||
static constexpr bool is_requirable = true;
|
||||
|
||||
/// The relationship_t::fork_t property can be preferred.
|
||||
static constexpr bool is_preferable = true;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef relationship_t polymorphic_query_result_type;
|
||||
|
||||
/// Default constructor.
|
||||
constexpr fork_t();
|
||||
|
||||
/// Get the value associated with a property object.
|
||||
/**
|
||||
* @returns fork_t();
|
||||
*/
|
||||
static constexpr relationship_t value();
|
||||
};
|
||||
|
||||
/// A sub-property that indicates that the executor represents a continuation
|
||||
/// of the calling context.
|
||||
struct continuation_t
|
||||
{
|
||||
/// The relationship_t::continuation_t property applies to executors,
|
||||
/// senders, and schedulers.
|
||||
template <typename T>
|
||||
static constexpr bool is_applicable_property_v =
|
||||
is_executor_v<T> || is_sender_v<T> || is_scheduler_v<T>;
|
||||
|
||||
/// The relationship_t::continuation_t property can be required.
|
||||
static constexpr bool is_requirable = true;
|
||||
|
||||
/// The relationship_t::continuation_t property can be preferred.
|
||||
static constexpr bool is_preferable = true;
|
||||
|
||||
/// The type returned by queries against an @c any_executor.
|
||||
typedef relationship_t polymorphic_query_result_type;
|
||||
|
||||
/// Default constructor.
|
||||
constexpr continuation_t();
|
||||
|
||||
/// Get the value associated with a property object.
|
||||
/**
|
||||
* @returns continuation_t();
|
||||
*/
|
||||
static constexpr relationship_t value();
|
||||
};
|
||||
|
||||
/// A special value used for accessing the relationship_t::fork_t property.
|
||||
static constexpr fork_t fork;
|
||||
|
||||
/// A special value used for accessing the relationship_t::continuation_t
|
||||
/// property.
|
||||
static constexpr continuation_t continuation;
|
||||
|
||||
/// Default constructor.
|
||||
constexpr relationship_t();
|
||||
|
||||
/// Construct from a sub-property value.
|
||||
constexpr relationship_t(fork_t);
|
||||
|
||||
/// Construct from a sub-property value.
|
||||
constexpr relationship_t(continuation_t);
|
||||
|
||||
/// Compare property values for equality.
|
||||
friend constexpr bool operator==(
|
||||
const relationship_t& a, const relationship_t& b) noexcept;
|
||||
|
||||
/// Compare property values for inequality.
|
||||
friend constexpr bool operator!=(
|
||||
const relationship_t& a, const relationship_t& b) noexcept;
|
||||
};
|
||||
|
||||
/// A special value used for accessing the relationship_t property.
|
||||
constexpr relationship_t relationship;
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
namespace relationship {
|
||||
|
||||
template <int I> struct fork_t;
|
||||
template <int I> struct continuation_t;
|
||||
|
||||
} // namespace relationship
|
||||
|
||||
template <int I = 0>
|
||||
struct relationship_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = false);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = false);
|
||||
typedef relationship_t polymorphic_query_result_type;
|
||||
|
||||
typedef detail::relationship::fork_t<I> fork_t;
|
||||
typedef detail::relationship::continuation_t<I> continuation_t;
|
||||
|
||||
ASIO_CONSTEXPR relationship_t()
|
||||
: value_(-1)
|
||||
{
|
||||
}
|
||||
|
||||
ASIO_CONSTEXPR relationship_t(fork_t)
|
||||
: value_(0)
|
||||
{
|
||||
}
|
||||
|
||||
ASIO_CONSTEXPR relationship_t(continuation_t)
|
||||
: value_(1)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
auto query(ASIO_MOVE_ARG(P) p) const
|
||||
noexcept(
|
||||
noexcept(
|
||||
declval<typename conditional<true, T, P>::type>().query(
|
||||
ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
declval<typename conditional<true, T, P>::type>().query(
|
||||
ASIO_MOVE_CAST(P)(p))
|
||||
);
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_proxy
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
struct type
|
||||
{
|
||||
template <typename P>
|
||||
static constexpr auto query(ASIO_MOVE_ARG(P) p)
|
||||
noexcept(
|
||||
noexcept(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
)
|
||||
-> decltype(
|
||||
conditional<true, T, P>::type::query(ASIO_MOVE_CAST(P)(p))
|
||||
)
|
||||
{
|
||||
return T::query(ASIO_MOVE_CAST(P)(p));
|
||||
}
|
||||
};
|
||||
#else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
typedef T type;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct query_member :
|
||||
traits::query_member<typename proxy<T>::type, relationship_t> {};
|
||||
|
||||
template <typename T>
|
||||
struct query_static_constexpr_member :
|
||||
traits::query_static_constexpr_member<
|
||||
typename static_proxy<T>::type, relationship_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static ASIO_CONSTEXPR
|
||||
typename traits::static_query<T, fork_t>::result_type
|
||||
static_query(
|
||||
typename enable_if<
|
||||
!query_static_constexpr_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!query_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
traits::static_query<T, fork_t>::is_valid
|
||||
>::type* = 0) ASIO_NOEXCEPT
|
||||
{
|
||||
return traits::static_query<T, fork_t>::value();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static ASIO_CONSTEXPR
|
||||
typename traits::static_query<T, continuation_t>::result_type
|
||||
static_query(
|
||||
typename enable_if<
|
||||
!query_static_constexpr_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!query_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!traits::static_query<T, fork_t>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
traits::static_query<T, continuation_t>::is_valid
|
||||
>::type* = 0) ASIO_NOEXCEPT
|
||||
{
|
||||
return traits::static_query<T, continuation_t>::value();
|
||||
}
|
||||
|
||||
template <typename E,
|
||||
typename T = decltype(relationship_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= relationship_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator==(
|
||||
const relationship_t& a, const relationship_t& b)
|
||||
{
|
||||
return a.value_ == b.value_;
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator!=(
|
||||
const relationship_t& a, const relationship_t& b)
|
||||
{
|
||||
return a.value_ != b.value_;
|
||||
}
|
||||
|
||||
struct convertible_from_relationship_t
|
||||
{
|
||||
ASIO_CONSTEXPR convertible_from_relationship_t(relationship_t)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Executor>
|
||||
friend ASIO_CONSTEXPR relationship_t query(
|
||||
const Executor& ex, convertible_from_relationship_t,
|
||||
typename enable_if<
|
||||
can_query<const Executor&, fork_t>::value
|
||||
>::type* = 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&, relationship_t<>::fork_t>::value))
|
||||
#else // defined(ASIO_MSVC)
|
||||
ASIO_NOEXCEPT_IF((
|
||||
is_nothrow_query<const Executor&, fork_t>::value))
|
||||
#endif // defined(ASIO_MSVC)
|
||||
#endif // !defined(__clang__)
|
||||
{
|
||||
return asio::query(ex, fork_t());
|
||||
}
|
||||
|
||||
template <typename Executor>
|
||||
friend ASIO_CONSTEXPR relationship_t query(
|
||||
const Executor& ex, convertible_from_relationship_t,
|
||||
typename enable_if<
|
||||
!can_query<const Executor&, fork_t>::value
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
can_query<const Executor&, continuation_t>::value
|
||||
>::type* = 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&,
|
||||
relationship_t<>::continuation_t>::value))
|
||||
#else // defined(ASIO_MSVC)
|
||||
ASIO_NOEXCEPT_IF((
|
||||
is_nothrow_query<const Executor&, continuation_t>::value))
|
||||
#endif // defined(ASIO_MSVC)
|
||||
#endif // !defined(__clang__)
|
||||
{
|
||||
return asio::query(ex, continuation_t());
|
||||
}
|
||||
|
||||
ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(fork_t, fork);
|
||||
ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(continuation_t, continuation);
|
||||
|
||||
#if !defined(ASIO_HAS_CONSTEXPR)
|
||||
static const relationship_t instance;
|
||||
#endif // !defined(ASIO_HAS_CONSTEXPR)
|
||||
|
||||
private:
|
||||
int value_;
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T relationship_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 relationship_t<I> relationship_t<I>::instance;
|
||||
#endif
|
||||
|
||||
template <int I>
|
||||
const typename relationship_t<I>::fork_t
|
||||
relationship_t<I>::fork;
|
||||
|
||||
template <int I>
|
||||
const typename relationship_t<I>::continuation_t
|
||||
relationship_t<I>::continuation;
|
||||
|
||||
namespace relationship {
|
||||
|
||||
template <int I = 0>
|
||||
struct fork_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
|
||||
typedef relationship_t<I> polymorphic_query_result_type;
|
||||
|
||||
ASIO_CONSTEXPR fork_t()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct query_member :
|
||||
traits::query_member<
|
||||
typename relationship_t<I>::template proxy<T>::type, fork_t> {};
|
||||
|
||||
template <typename T>
|
||||
struct query_static_constexpr_member :
|
||||
traits::query_static_constexpr_member<
|
||||
typename relationship_t<I>::template static_proxy<T>::type, fork_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static ASIO_CONSTEXPR fork_t static_query(
|
||||
typename enable_if<
|
||||
!query_static_constexpr_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!query_member<T>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!traits::query_free<T, fork_t>::is_valid
|
||||
>::type* = 0,
|
||||
typename enable_if<
|
||||
!can_query<T, continuation_t<I> >::value
|
||||
>::type* = 0) ASIO_NOEXCEPT
|
||||
{
|
||||
return fork_t();
|
||||
}
|
||||
|
||||
template <typename E, typename T = decltype(fork_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= fork_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
static ASIO_CONSTEXPR relationship_t<I> value()
|
||||
{
|
||||
return fork_t();
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator==(
|
||||
const fork_t&, const fork_t&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator!=(
|
||||
const fork_t&, const fork_t&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T fork_t<I>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <int I = 0>
|
||||
struct continuation_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));
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_requirable = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_preferable = true);
|
||||
typedef relationship_t<I> polymorphic_query_result_type;
|
||||
|
||||
ASIO_CONSTEXPR continuation_t()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct query_member :
|
||||
traits::query_member<
|
||||
typename relationship_t<I>::template proxy<T>::type, continuation_t> {};
|
||||
|
||||
template <typename T>
|
||||
struct query_static_constexpr_member :
|
||||
traits::query_static_constexpr_member<
|
||||
typename relationship_t<I>::template static_proxy<T>::type,
|
||||
continuation_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_query()
|
||||
ASIO_NOEXCEPT_IF((
|
||||
query_static_constexpr_member<T>::is_noexcept))
|
||||
{
|
||||
return query_static_constexpr_member<T>::value();
|
||||
}
|
||||
|
||||
template <typename E,
|
||||
typename T = decltype(continuation_t::static_query<E>())>
|
||||
static ASIO_CONSTEXPR const T static_query_v
|
||||
= continuation_t::static_query<E>();
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
static ASIO_CONSTEXPR relationship_t<I> value()
|
||||
{
|
||||
return continuation_t();
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator==(
|
||||
const continuation_t&, const continuation_t&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
friend ASIO_CONSTEXPR bool operator!=(
|
||||
const continuation_t&, const continuation_t&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
&& defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
template <int I> template <typename E, typename T>
|
||||
const T continuation_t<I>::static_query_v;
|
||||
#endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
|
||||
// && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace relationship
|
||||
} // namespace detail
|
||||
|
||||
typedef detail::relationship_t<> relationship_t;
|
||||
|
||||
#if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
constexpr relationship_t relationship;
|
||||
#else // defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
|
||||
namespace { static const relationship_t&
|
||||
relationship = relationship_t::instance; }
|
||||
#endif
|
||||
|
||||
} // namespace execution
|
||||
|
||||
#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::relationship_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>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::relationship_t::fork_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>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_applicable_property<T, execution::relationship_t::continuation_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>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
namespace traits {
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
template <typename T>
|
||||
struct query_free_default<T, execution::relationship_t,
|
||||
typename enable_if<
|
||||
can_query<T, execution::relationship_t::fork_t>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(is_nothrow_query<T, execution::relationship_t::fork_t>::value));
|
||||
|
||||
typedef execution::relationship_t result_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct query_free_default<T, execution::relationship_t,
|
||||
typename enable_if<
|
||||
!can_query<T, execution::relationship_t::fork_t>::value
|
||||
&& can_query<T, execution::relationship_t::continuation_t>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept =
|
||||
(is_nothrow_query<T, execution::relationship_t::continuation_t>::value));
|
||||
|
||||
typedef execution::relationship_t result_type;
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
|
||||
|
||||
#if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
|
||||
|| !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::relationship_t,
|
||||
typename enable_if<
|
||||
execution::detail::relationship_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::relationship_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::relationship_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::relationship_t,
|
||||
typename enable_if<
|
||||
!execution::detail::relationship_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
&& !execution::detail::relationship_t<0>::
|
||||
query_member<T>::is_valid
|
||||
&& traits::static_query<T,
|
||||
execution::relationship_t::fork_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename traits::static_query<T,
|
||||
execution::relationship_t::fork_t>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return traits::static_query<T,
|
||||
execution::relationship_t::fork_t>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::relationship_t,
|
||||
typename enable_if<
|
||||
!execution::detail::relationship_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
&& !execution::detail::relationship_t<0>::
|
||||
query_member<T>::is_valid
|
||||
&& !traits::static_query<T,
|
||||
execution::relationship_t::fork_t>::is_valid
|
||||
&& traits::static_query<T,
|
||||
execution::relationship_t::continuation_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename traits::static_query<T,
|
||||
execution::relationship_t::continuation_t>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return traits::static_query<T,
|
||||
execution::relationship_t::continuation_t>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::relationship_t::fork_t,
|
||||
typename enable_if<
|
||||
execution::detail::relationship::fork_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::relationship::fork_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::relationship::fork_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::relationship_t::fork_t,
|
||||
typename enable_if<
|
||||
!execution::detail::relationship::fork_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
&& !execution::detail::relationship::fork_t<0>::
|
||||
query_member<T>::is_valid
|
||||
&& !traits::query_free<T,
|
||||
execution::relationship_t::fork_t>::is_valid
|
||||
&& !can_query<T, execution::relationship_t::continuation_t>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef execution::relationship_t::fork_t result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_query<T, execution::relationship_t::continuation_t,
|
||||
typename enable_if<
|
||||
execution::detail::relationship::continuation_t<0>::
|
||||
query_static_constexpr_member<T>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
typedef typename execution::detail::relationship::continuation_t<0>::
|
||||
query_static_constexpr_member<T>::result_type result_type;
|
||||
|
||||
static ASIO_CONSTEXPR result_type value()
|
||||
{
|
||||
return execution::detail::relationship::continuation_t<0>::
|
||||
query_static_constexpr_member<T>::value();
|
||||
}
|
||||
};
|
||||
|
||||
#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::relationship_t::fork_t,
|
||||
typename enable_if<
|
||||
static_query<T, execution::relationship_t::fork_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid =
|
||||
(is_same<typename static_query<T,
|
||||
execution::relationship_t::fork_t>::result_type,
|
||||
execution::relationship_t::fork_t>::value));
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct static_require<T, execution::relationship_t::continuation_t,
|
||||
typename enable_if<
|
||||
static_query<T, execution::relationship_t::continuation_t>::is_valid
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_valid =
|
||||
(is_same<typename static_query<T,
|
||||
execution::relationship_t::continuation_t>::result_type,
|
||||
execution::relationship_t::continuation_t>::value));
|
||||
};
|
||||
|
||||
#endif // !defined(ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT)
|
||||
|
||||
} // namespace traits
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_RELATIONSHIP_HPP
|
||||
287
extern/asio-1.18.2/include/asio/execution/schedule.hpp
vendored
Normal file
287
extern/asio-1.18.2/include/asio/execution/schedule.hpp
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
//
|
||||
// execution/schedule.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_SCHEDULE_HPP
|
||||
#define ASIO_EXECUTION_SCHEDULE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/executor.hpp"
|
||||
#include "asio/traits/schedule_member.hpp"
|
||||
#include "asio/traits/schedule_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that is used to obtain a sender from a scheduler.
|
||||
/**
|
||||
* The name <tt>execution::schedule</tt> denotes a customisation point object.
|
||||
* For some subexpression <tt>s</tt>, let <tt>S</tt> be a type such that
|
||||
* <tt>decltype((s))</tt> is <tt>S</tt>. The expression
|
||||
* <tt>execution::schedule(s)</tt> is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>s.schedule()</tt>, if that expression is valid and its type models
|
||||
* <tt>sender</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>schedule(s)</tt>, if that expression is valid and its
|
||||
* type models <tt>sender</tt> with overload resolution performed in a context
|
||||
* that includes the declaration <tt>void schedule();</tt> and that does not
|
||||
* include a declaration of <tt>execution::schedule</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>S</tt> if <tt>S</tt> satisfies <tt>executor</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>execution::schedule(s)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified schedule = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c schedule expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_schedule is a trait that is derived from @c true_type
|
||||
* if the expression <tt>execution::schedule(std::declval<S>())</tt> is well
|
||||
* formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename S>
|
||||
struct can_schedule :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_schedule_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::execution::is_executor;
|
||||
using asio::traits::schedule_free;
|
||||
using asio::traits::schedule_member;
|
||||
|
||||
void schedule();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
identity,
|
||||
call_member,
|
||||
call_free,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename S, typename = void, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct call_traits<S,
|
||||
typename enable_if<
|
||||
schedule_member<S>::is_valid
|
||||
>::type> :
|
||||
schedule_member<S>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct call_traits<S,
|
||||
typename enable_if<
|
||||
!schedule_member<S>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
schedule_free<S>::is_valid
|
||||
>::type> :
|
||||
schedule_free<S>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct call_traits<S,
|
||||
typename enable_if<
|
||||
!schedule_member<S>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!schedule_free<S>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_executor<typename decay<S>::type>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = identity);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(S) result_type;
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
typedef ASIO_MOVE_ARG(typename decay<S>::type) result_type;
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
template <typename S>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S>::overload == identity,
|
||||
typename call_traits<S>::result_type
|
||||
>::type
|
||||
operator()(ASIO_MOVE_ARG(S) s) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(S)(s);
|
||||
}
|
||||
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename S>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S>::overload == call_member,
|
||||
typename call_traits<S>::result_type
|
||||
>::type
|
||||
operator()(S&& s) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(S)(s).schedule();
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S>::overload == call_free,
|
||||
typename call_traits<S>::result_type
|
||||
>::type
|
||||
operator()(S&& s) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S>::is_noexcept))
|
||||
{
|
||||
return schedule(ASIO_MOVE_CAST(S)(s));
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
template <typename S>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&>::overload == call_member,
|
||||
typename call_traits<S&>::result_type
|
||||
>::type
|
||||
operator()(S& s) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&>::is_noexcept))
|
||||
{
|
||||
return s.schedule();
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&>::overload == call_member,
|
||||
typename call_traits<const S&>::result_type
|
||||
>::type
|
||||
operator()(const S& s) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&>::is_noexcept))
|
||||
{
|
||||
return s.schedule();
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&>::overload == call_free,
|
||||
typename call_traits<S&>::result_type
|
||||
>::type
|
||||
operator()(S& s) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&>::is_noexcept))
|
||||
{
|
||||
return schedule(s);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&>::overload == call_free,
|
||||
typename call_traits<const S&>::result_type
|
||||
>::type
|
||||
operator()(const S& s) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&>::is_noexcept))
|
||||
{
|
||||
return schedule(s);
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_schedule_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_schedule_fn::impl&
|
||||
schedule = asio_execution_schedule_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename S>
|
||||
struct can_schedule :
|
||||
integral_constant<bool,
|
||||
asio_execution_schedule_fn::call_traits<S>::overload !=
|
||||
asio_execution_schedule_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S>
|
||||
constexpr bool can_schedule_v = can_schedule<S>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S>
|
||||
struct is_nothrow_schedule :
|
||||
integral_constant<bool,
|
||||
asio_execution_schedule_fn::call_traits<S>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S>
|
||||
constexpr bool is_nothrow_schedule_v
|
||||
= is_nothrow_schedule<S>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_SCHEDULE_HPP
|
||||
86
extern/asio-1.18.2/include/asio/execution/scheduler.hpp
vendored
Normal file
86
extern/asio-1.18.2/include/asio/execution/scheduler.hpp
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// execution/scheduler.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_SCHEDULER_HPP
|
||||
#define ASIO_EXECUTION_SCHEDULER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/schedule.hpp"
|
||||
#include "asio/traits/equality_comparable.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct is_scheduler_base :
|
||||
integral_constant<bool,
|
||||
is_copy_constructible<typename remove_cvref<T>::type>::value
|
||||
&& traits::equality_comparable<typename remove_cvref<T>::type>::is_valid
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// The is_scheduler trait detects whether a type T satisfies the
|
||||
/// execution::scheduler concept.
|
||||
/**
|
||||
* Class template @c is_scheduler is a type trait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for a scheduler for
|
||||
* error type @c E, otherwise @c false_type.
|
||||
*/
|
||||
template <typename T>
|
||||
struct is_scheduler :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
conditional<
|
||||
can_schedule<T>::value,
|
||||
detail::is_scheduler_base<T>,
|
||||
false_type
|
||||
>::type
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONSTEXPR const bool is_scheduler_v = is_scheduler<T>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONCEPT scheduler = is_scheduler<T>::value;
|
||||
|
||||
#define ASIO_EXECUTION_SCHEDULER ::asio::execution::scheduler
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_SCHEDULER typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_SCHEDULER_HPP
|
||||
311
extern/asio-1.18.2/include/asio/execution/sender.hpp
vendored
Normal file
311
extern/asio-1.18.2/include/asio/execution/sender.hpp
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
//
|
||||
// execution/sender.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_SENDER_HPP
|
||||
#define ASIO_EXECUTION_SENDER_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/detail/as_invocable.hpp"
|
||||
#include "asio/execution/detail/void_receiver.hpp"
|
||||
#include "asio/execution/executor.hpp"
|
||||
#include "asio/execution/receiver.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(ASIO_HAS_ALIAS_TEMPLATES) \
|
||||
&& defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
&& defined(ASIO_HAS_DECLTYPE) \
|
||||
&& !defined(ASIO_MSVC) || (_MSC_VER >= 1910)
|
||||
# define ASIO_HAS_DEDUCED_EXECUTION_IS_TYPED_SENDER_TRAIT 1
|
||||
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
|
||||
// && defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// && defined(ASIO_HAS_DECLTYPE)
|
||||
// && !defined(ASIO_MSVC) || (_MSC_VER >= 1910)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace detail {
|
||||
|
||||
namespace sender_base_ns { struct sender_base {}; }
|
||||
|
||||
template <typename S, typename = void>
|
||||
struct sender_traits_base
|
||||
{
|
||||
typedef void asio_execution_sender_traits_base_is_unspecialised;
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct sender_traits_base<S,
|
||||
typename enable_if<
|
||||
is_base_of<sender_base_ns::sender_base, S>::value
|
||||
>::type>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename S, typename = void, typename = void, typename = void>
|
||||
struct has_sender_types : false_type
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_DEDUCED_EXECUTION_IS_TYPED_SENDER_TRAIT)
|
||||
|
||||
template <
|
||||
template <
|
||||
template <typename...> class Tuple,
|
||||
template <typename...> class Variant
|
||||
> class>
|
||||
struct has_value_types
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <
|
||||
template <
|
||||
template <typename...> class Variant
|
||||
> class>
|
||||
struct has_error_types
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct has_sender_types<S,
|
||||
typename has_value_types<S::template value_types>::type,
|
||||
typename has_error_types<S::template error_types>::type,
|
||||
typename conditional<S::sends_done, void, void>::type> : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct sender_traits_base<S,
|
||||
typename enable_if<
|
||||
has_sender_types<S>::value
|
||||
>::type>
|
||||
{
|
||||
template <
|
||||
template <typename...> class Tuple,
|
||||
template <typename...> class Variant>
|
||||
using value_types = typename S::template value_types<Tuple, Variant>;
|
||||
|
||||
template <template <typename...> class Variant>
|
||||
using error_types = typename S::template error_types<Variant>;
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, sends_done = S::sends_done);
|
||||
};
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_EXECUTION_IS_TYPED_SENDER_TRAIT)
|
||||
|
||||
template <typename S>
|
||||
struct sender_traits_base<S,
|
||||
typename enable_if<
|
||||
!has_sender_types<S>::value
|
||||
&& detail::is_executor_of_impl<S,
|
||||
as_invocable<void_receiver, S> >::value
|
||||
>::type>
|
||||
{
|
||||
#if defined(ASIO_HAS_DEDUCED_EXECUTION_IS_TYPED_SENDER_TRAIT) \
|
||||
&& defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
|
||||
template <
|
||||
template <typename...> class Tuple,
|
||||
template <typename...> class Variant>
|
||||
using value_types = Variant<Tuple<>>;
|
||||
|
||||
template <template <typename...> class Variant>
|
||||
using error_types = Variant<std::exception_ptr>;
|
||||
|
||||
ASIO_STATIC_CONSTEXPR(bool, sends_done = true);
|
||||
|
||||
#endif // defined(ASIO_HAS_DEDUCED_EXECUTION_IS_TYPED_SENDER_TRAIT)
|
||||
// && defined(ASIO_HAS_STD_EXCEPTION_PTR)
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// Base class used for tagging senders.
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
typedef unspecified sender_base;
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
typedef detail::sender_base_ns::sender_base sender_base;
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Traits for senders.
|
||||
template <typename S>
|
||||
struct sender_traits
|
||||
#if !defined(GENERATING_DOCUMENTATION)
|
||||
: detail::sender_traits_base<S>
|
||||
#endif // !defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename S, typename = void>
|
||||
struct has_sender_traits : true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename S>
|
||||
struct has_sender_traits<S,
|
||||
typename enable_if<
|
||||
is_same<
|
||||
typename asio::execution::sender_traits<
|
||||
S>::asio_execution_sender_traits_base_is_unspecialised,
|
||||
void
|
||||
>::value
|
||||
>::type> : false_type
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// The is_sender trait detects whether a type T satisfies the
|
||||
/// execution::sender concept.
|
||||
|
||||
/**
|
||||
* Class template @c is_sender is a type trait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for a sender,
|
||||
* otherwise @c false_type.
|
||||
*/
|
||||
template <typename T>
|
||||
struct is_sender :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
conditional<
|
||||
detail::has_sender_traits<typename remove_cvref<T>::type>::value,
|
||||
is_move_constructible<typename remove_cvref<T>::type>,
|
||||
false_type
|
||||
>::type
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONSTEXPR const bool is_sender_v = is_sender<T>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONCEPT sender = is_sender<T>::value;
|
||||
|
||||
#define ASIO_EXECUTION_SENDER ::asio::execution::sender
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_SENDER typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename S, typename R>
|
||||
struct can_connect;
|
||||
|
||||
/// The is_sender_to trait detects whether a type T satisfies the
|
||||
/// execution::sender_to concept for some receiver.
|
||||
/**
|
||||
* Class template @c is_sender_to is a type trait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for a sender
|
||||
* for some receiver type R, otherwise @c false.
|
||||
*/
|
||||
template <typename T, typename R>
|
||||
struct is_sender_to :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool,
|
||||
is_sender<T>::value
|
||||
&& is_receiver<R>::value
|
||||
&& can_connect<T, R>::value
|
||||
>
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T, typename R>
|
||||
ASIO_CONSTEXPR const bool is_sender_to_v =
|
||||
is_sender_to<T, R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T, typename R>
|
||||
ASIO_CONCEPT sender_to = is_sender_to<T, R>::value;
|
||||
|
||||
#define ASIO_EXECUTION_SENDER_TO(r) \
|
||||
::asio::execution::sender_to<r>
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_SENDER_TO(r) typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
/// The is_typed_sender trait detects whether a type T satisfies the
|
||||
/// execution::typed_sender concept.
|
||||
/**
|
||||
* Class template @c is_typed_sender is a type trait that is derived from @c
|
||||
* true_type if the type @c T meets the concept definition for a typed sender,
|
||||
* otherwise @c false.
|
||||
*/
|
||||
template <typename T>
|
||||
struct is_typed_sender :
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool, automatically_determined>
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
integral_constant<bool,
|
||||
is_sender<T>::value
|
||||
&& detail::has_sender_types<
|
||||
sender_traits<typename remove_cvref<T>::type> >::value
|
||||
>
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONSTEXPR const bool is_typed_sender_v = is_typed_sender<T>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#if defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
template <typename T>
|
||||
ASIO_CONCEPT typed_sender = is_typed_sender<T>::value;
|
||||
|
||||
#define ASIO_EXECUTION_TYPED_SENDER \
|
||||
::asio::execution::typed_sender
|
||||
|
||||
#else // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
#define ASIO_EXECUTION_TYPED_SENDER typename
|
||||
|
||||
#endif // defined(ASIO_HAS_CONCEPTS)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#include "asio/execution/connect.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_SENDER_HPP
|
||||
250
extern/asio-1.18.2/include/asio/execution/set_done.hpp
vendored
Normal file
250
extern/asio-1.18.2/include/asio/execution/set_done.hpp
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
//
|
||||
// execution/set_done.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_SET_DONE_HPP
|
||||
#define ASIO_EXECUTION_SET_DONE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/traits/set_done_member.hpp"
|
||||
#include "asio/traits/set_done_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that delivers a done notification to a receiver.
|
||||
/**
|
||||
* The name <tt>execution::set_done</tt> denotes a customisation point object.
|
||||
* The expression <tt>execution::set_done(R)</tt> for some subexpression
|
||||
* <tt>R</tt> is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>R.set_done()</tt>, if that expression is valid. If the function
|
||||
* selected does not signal the receiver <tt>R</tt>'s done channel, the
|
||||
* program is ill-formed with no diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>set_done(R)</tt>, if that expression is valid, with
|
||||
* overload resolution performed in a context that includes the declaration
|
||||
* <tt>void set_done();</tt> and that does not include a declaration of
|
||||
* <tt>execution::set_done</tt>. If the function selected by overload
|
||||
* resolution does not signal the receiver <tt>R</tt>'s done channel, the
|
||||
* program is ill-formed with no diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>execution::set_done(R)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified set_done = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c set_done expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_set_done is a trait that is derived from
|
||||
* @c true_type if the expression <tt>execution::set_done(std::declval<R>(),
|
||||
* std::declval<E>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename R>
|
||||
struct can_set_done :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_set_done_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::traits::set_done_free;
|
||||
using asio::traits::set_done_member;
|
||||
|
||||
void set_done();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename R, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename R>
|
||||
struct call_traits<R,
|
||||
typename enable_if<
|
||||
set_done_member<R>::is_valid
|
||||
>::type> :
|
||||
set_done_member<R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename R>
|
||||
struct call_traits<R,
|
||||
typename enable_if<
|
||||
!set_done_member<R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
set_done_free<R>::is_valid
|
||||
>::type> :
|
||||
set_done_free<R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R>::overload == call_member,
|
||||
typename call_traits<R>::result_type
|
||||
>::type
|
||||
operator()(R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(R)(r).set_done();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R>::overload == call_free,
|
||||
typename call_traits<R>::result_type
|
||||
>::type
|
||||
operator()(R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R>::is_noexcept))
|
||||
{
|
||||
return set_done(ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&>::overload == call_member,
|
||||
typename call_traits<R&>::result_type
|
||||
>::type
|
||||
operator()(R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&>::is_noexcept))
|
||||
{
|
||||
return r.set_done();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&>::overload == call_member,
|
||||
typename call_traits<const R&>::result_type
|
||||
>::type
|
||||
operator()(const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&>::is_noexcept))
|
||||
{
|
||||
return r.set_done();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&>::overload == call_free,
|
||||
typename call_traits<R&>::result_type
|
||||
>::type
|
||||
operator()(R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&>::is_noexcept))
|
||||
{
|
||||
return set_done(r);
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&>::overload == call_free,
|
||||
typename call_traits<const R&>::result_type
|
||||
>::type
|
||||
operator()(const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&>::is_noexcept))
|
||||
{
|
||||
return set_done(r);
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_set_done_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_set_done_fn::impl&
|
||||
set_done = asio_execution_set_done_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename R>
|
||||
struct can_set_done :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_done_fn::call_traits<R>::overload !=
|
||||
asio_execution_set_done_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
constexpr bool can_set_done_v = can_set_done<R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
struct is_nothrow_set_done :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_done_fn::call_traits<R>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
constexpr bool is_nothrow_set_done_v
|
||||
= is_nothrow_set_done<R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_SET_DONE_HPP
|
||||
250
extern/asio-1.18.2/include/asio/execution/set_error.hpp
vendored
Normal file
250
extern/asio-1.18.2/include/asio/execution/set_error.hpp
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
//
|
||||
// execution/set_error.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_SET_ERROR_HPP
|
||||
#define ASIO_EXECUTION_SET_ERROR_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/traits/set_error_member.hpp"
|
||||
#include "asio/traits/set_error_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that delivers an error notification to a receiver.
|
||||
/**
|
||||
* The name <tt>execution::set_error</tt> denotes a customisation point object.
|
||||
* The expression <tt>execution::set_error(R, E)</tt> for some subexpressions
|
||||
* <tt>R</tt> and <tt>E</tt> are expression-equivalent to:
|
||||
*
|
||||
* @li <tt>R.set_error(E)</tt>, if that expression is valid. If the function
|
||||
* selected does not send the error <tt>E</tt> to the receiver <tt>R</tt>'s
|
||||
* error channel, the program is ill-formed with no diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>set_error(R, E)</tt>, if that expression is valid, with
|
||||
* overload resolution performed in a context that includes the declaration
|
||||
* <tt>void set_error();</tt> and that does not include a declaration of
|
||||
* <tt>execution::set_error</tt>. If the function selected by overload
|
||||
* resolution does not send the error <tt>E</tt> to the receiver <tt>R</tt>'s
|
||||
* error channel, the program is ill-formed with no diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>execution::set_error(R, E)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified set_error = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c set_error expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_set_error is a trait that is derived from
|
||||
* @c true_type if the expression <tt>execution::set_error(std::declval<R>(),
|
||||
* std::declval<E>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename R, typename E>
|
||||
struct can_set_error :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_set_error_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::traits::set_error_free;
|
||||
using asio::traits::set_error_member;
|
||||
|
||||
void set_error();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename R, typename E, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename R, typename E>
|
||||
struct call_traits<R, void(E),
|
||||
typename enable_if<
|
||||
set_error_member<R, E>::is_valid
|
||||
>::type> :
|
||||
set_error_member<R, E>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename R, typename E>
|
||||
struct call_traits<R, void(E),
|
||||
typename enable_if<
|
||||
!set_error_member<R, E>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
set_error_free<R, E>::is_valid
|
||||
>::type> :
|
||||
set_error_free<R, E>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename R, typename E>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R, void(E)>::overload == call_member,
|
||||
typename call_traits<R, void(E)>::result_type
|
||||
>::type
|
||||
operator()(R&& r, E&& e) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R, void(E)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(R)(r).set_error(ASIO_MOVE_CAST(E)(e));
|
||||
}
|
||||
|
||||
template <typename R, typename E>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R, void(E)>::overload == call_free,
|
||||
typename call_traits<R, void(E)>::result_type
|
||||
>::type
|
||||
operator()(R&& r, E&& e) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R, void(E)>::is_noexcept))
|
||||
{
|
||||
return set_error(ASIO_MOVE_CAST(R)(r), ASIO_MOVE_CAST(E)(e));
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
template <typename R, typename E>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&, void(const E&)>::overload == call_member,
|
||||
typename call_traits<R&, void(const E&)>::result_type
|
||||
>::type
|
||||
operator()(R& r, const E& e) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&, void(const E&)>::is_noexcept))
|
||||
{
|
||||
return r.set_error(e);
|
||||
}
|
||||
|
||||
template <typename R, typename E>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&, void(const E&)>::overload == call_member,
|
||||
typename call_traits<const R&, void(const E&)>::result_type
|
||||
>::type
|
||||
operator()(const R& r, const E& e) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&, void(const E&)>::is_noexcept))
|
||||
{
|
||||
return r.set_error(e);
|
||||
}
|
||||
|
||||
template <typename R, typename E>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&, void(const E&)>::overload == call_free,
|
||||
typename call_traits<R&, void(const E&)>::result_type
|
||||
>::type
|
||||
operator()(R& r, const E& e) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&, void(const E&)>::is_noexcept))
|
||||
{
|
||||
return set_error(r, e);
|
||||
}
|
||||
|
||||
template <typename R, typename E>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&, void(const E&)>::overload == call_free,
|
||||
typename call_traits<const R&, void(const E&)>::result_type
|
||||
>::type
|
||||
operator()(const R& r, const E& e) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&, void(const E&)>::is_noexcept))
|
||||
{
|
||||
return set_error(r, e);
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_set_error_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_set_error_fn::impl&
|
||||
set_error = asio_execution_set_error_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename R, typename E>
|
||||
struct can_set_error :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_error_fn::call_traits<R, void(E)>::overload !=
|
||||
asio_execution_set_error_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R, typename E>
|
||||
constexpr bool can_set_error_v = can_set_error<R, E>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R, typename E>
|
||||
struct is_nothrow_set_error :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_error_fn::call_traits<R, void(E)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R, typename E>
|
||||
constexpr bool is_nothrow_set_error_v
|
||||
= is_nothrow_set_error<R, E>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_SET_ERROR_HPP
|
||||
483
extern/asio-1.18.2/include/asio/execution/set_value.hpp
vendored
Normal file
483
extern/asio-1.18.2/include/asio/execution/set_value.hpp
vendored
Normal file
@@ -0,0 +1,483 @@
|
||||
//
|
||||
// execution/set_value.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_SET_VALUE_HPP
|
||||
#define ASIO_EXECUTION_SET_VALUE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/detail/variadic_templates.hpp"
|
||||
#include "asio/traits/set_value_member.hpp"
|
||||
#include "asio/traits/set_value_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that delivers a value to a receiver.
|
||||
/**
|
||||
* The name <tt>execution::set_value</tt> denotes a customisation point object.
|
||||
* The expression <tt>execution::set_value(R, Vs...)</tt> for some
|
||||
* subexpressions <tt>R</tt> and <tt>Vs...</tt> is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>R.set_value(Vs...)</tt>, if that expression is valid. If the
|
||||
* function selected does not send the value(s) <tt>Vs...</tt> to the receiver
|
||||
* <tt>R</tt>'s value channel, the program is ill-formed with no diagnostic
|
||||
* required.
|
||||
*
|
||||
* @li Otherwise, <tt>set_value(R, Vs...)</tt>, if that expression is valid,
|
||||
* with overload resolution performed in a context that includes the
|
||||
* declaration <tt>void set_value();</tt> and that does not include a
|
||||
* declaration of <tt>execution::set_value</tt>. If the function selected by
|
||||
* overload resolution does not send the value(s) <tt>Vs...</tt> to the
|
||||
* receiver <tt>R</tt>'s value channel, the program is ill-formed with no
|
||||
* diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>execution::set_value(R, Vs...)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified set_value = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c set_value expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_set_value is a trait that is derived from
|
||||
* @c true_type if the expression <tt>execution::set_value(std::declval<R>(),
|
||||
* std::declval<Vs>()...)</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename R, typename... Vs>
|
||||
struct can_set_value :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_set_value_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::traits::set_value_free;
|
||||
using asio::traits::set_value_member;
|
||||
|
||||
void set_value();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename R, typename Vs, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename R, typename Vs>
|
||||
struct call_traits<R, Vs,
|
||||
typename enable_if<
|
||||
set_value_member<R, Vs>::is_valid
|
||||
>::type> :
|
||||
set_value_member<R, Vs>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename R, typename Vs>
|
||||
struct call_traits<R, Vs,
|
||||
typename enable_if<
|
||||
!set_value_member<R, Vs>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
set_value_free<R, Vs>::is_valid
|
||||
>::type> :
|
||||
set_value_free<R, Vs>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R, void(Vs...)>::overload == call_member,
|
||||
typename call_traits<R, void(Vs...)>::result_type
|
||||
>::type
|
||||
operator()(R&& r, Vs&&... v) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R, void(Vs...)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(R)(r).set_value(ASIO_MOVE_CAST(Vs)(v)...);
|
||||
}
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R, void(Vs...)>::overload == call_free,
|
||||
typename call_traits<R, void(Vs...)>::result_type
|
||||
>::type
|
||||
operator()(R&& r, Vs&&... v) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R, void(Vs...)>::is_noexcept))
|
||||
{
|
||||
return set_value(ASIO_MOVE_CAST(R)(r),
|
||||
ASIO_MOVE_CAST(Vs)(v)...);
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R, void()>::overload == call_member,
|
||||
typename call_traits<R, void()>::result_type
|
||||
>::type
|
||||
operator()(R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R, void()>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(R)(r).set_value();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R, void()>::overload == call_free,
|
||||
typename call_traits<R, void()>::result_type
|
||||
>::type
|
||||
operator()(R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R, void()>::is_noexcept))
|
||||
{
|
||||
return set_value(ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
|
||||
#define ASIO_PRIVATE_SET_VALUE_CALL_DEF(n) \
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_CONSTEXPR typename enable_if< \
|
||||
call_traits<R, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::overload == call_member, \
|
||||
typename call_traits<R, void(ASIO_VARIADIC_TARGS(n))>::result_type \
|
||||
>::type \
|
||||
operator()(R&& r, ASIO_VARIADIC_MOVE_PARAMS(n)) const \
|
||||
ASIO_NOEXCEPT_IF(( \
|
||||
call_traits<R, void(ASIO_VARIADIC_TARGS(n))>::is_noexcept)) \
|
||||
{ \
|
||||
return ASIO_MOVE_CAST(R)(r).set_value( \
|
||||
ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
} \
|
||||
\
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_CONSTEXPR typename enable_if< \
|
||||
call_traits<R, void(ASIO_VARIADIC_TARGS(n))>::overload == call_free, \
|
||||
typename call_traits<R, void(ASIO_VARIADIC_TARGS(n))>::result_type \
|
||||
>::type \
|
||||
operator()(R&& r, ASIO_VARIADIC_MOVE_PARAMS(n)) const \
|
||||
ASIO_NOEXCEPT_IF(( \
|
||||
call_traits<R, void(ASIO_VARIADIC_TARGS(n))>::is_noexcept)) \
|
||||
{ \
|
||||
return set_value(ASIO_MOVE_CAST(R)(r), \
|
||||
ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_SET_VALUE_CALL_DEF)
|
||||
#undef ASIO_PRIVATE_SET_VALUE_CALL_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&, void(const Vs&...)>::overload == call_member,
|
||||
typename call_traits<R&, void(const Vs&...)>::result_type
|
||||
>::type
|
||||
operator()(R& r, const Vs&... v) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&, void(const Vs&...)>::is_noexcept))
|
||||
{
|
||||
return r.set_value(v...);
|
||||
}
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&, void(const Vs&...)>::overload == call_member,
|
||||
typename call_traits<const R&, void(const Vs&...)>::result_type
|
||||
>::type
|
||||
operator()(const R& r, const Vs&... v) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&, void(const Vs&...)>::is_noexcept))
|
||||
{
|
||||
return r.set_value(v...);
|
||||
}
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&, void(const Vs&...)>::overload == call_free,
|
||||
typename call_traits<R&, void(const Vs&...)>::result_type
|
||||
>::type
|
||||
operator()(R& r, const Vs&... v) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&, void(const Vs&...)>::is_noexcept))
|
||||
{
|
||||
return set_value(r, v...);
|
||||
}
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&, void(const Vs&...)>::overload == call_free,
|
||||
typename call_traits<const R&, void(const Vs&...)>::result_type
|
||||
>::type
|
||||
operator()(const R& r, const Vs&... v) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&, void(const Vs&...)>::is_noexcept))
|
||||
{
|
||||
return set_value(r, v...);
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&, void()>::overload == call_member,
|
||||
typename call_traits<R&, void()>::result_type
|
||||
>::type
|
||||
operator()(R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&, void()>::is_noexcept))
|
||||
{
|
||||
return r.set_value();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&, void()>::overload == call_member,
|
||||
typename call_traits<const R&, void()>::result_type
|
||||
>::type
|
||||
operator()(const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&, void()>::is_noexcept))
|
||||
{
|
||||
return r.set_value();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&, void()>::overload == call_free,
|
||||
typename call_traits<R&, void()>::result_type
|
||||
>::type
|
||||
operator()(R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&, void()>::is_noexcept))
|
||||
{
|
||||
return set_value(r);
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&, void()>::overload == call_free,
|
||||
typename call_traits<const R&, void()>::result_type
|
||||
>::type
|
||||
operator()(const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&, void()>::is_noexcept))
|
||||
{
|
||||
return set_value(r);
|
||||
}
|
||||
|
||||
#define ASIO_PRIVATE_SET_VALUE_CALL_DEF(n) \
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_CONSTEXPR typename enable_if< \
|
||||
call_traits<R&, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::overload == call_member, \
|
||||
typename call_traits<R&, void(ASIO_VARIADIC_TARGS(n))>::result_type \
|
||||
>::type \
|
||||
operator()(R& r, ASIO_VARIADIC_MOVE_PARAMS(n)) const \
|
||||
ASIO_NOEXCEPT_IF(( \
|
||||
call_traits<R&, void(ASIO_VARIADIC_TARGS(n))>::is_noexcept)) \
|
||||
{ \
|
||||
return r.set_value(ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
} \
|
||||
\
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_CONSTEXPR typename enable_if< \
|
||||
call_traits<const R&, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::overload == call_member, \
|
||||
typename call_traits<const R&, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::result_type \
|
||||
>::type \
|
||||
operator()(const R& r, ASIO_VARIADIC_MOVE_PARAMS(n)) const \
|
||||
ASIO_NOEXCEPT_IF(( \
|
||||
call_traits<const R&, void(ASIO_VARIADIC_TARGS(n))>::is_noexcept)) \
|
||||
{ \
|
||||
return r.set_value(ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
} \
|
||||
\
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_CONSTEXPR typename enable_if< \
|
||||
call_traits<R&, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::overload == call_free, \
|
||||
typename call_traits<R&, void(ASIO_VARIADIC_TARGS(n))>::result_type \
|
||||
>::type \
|
||||
operator()(R& r, ASIO_VARIADIC_MOVE_PARAMS(n)) const \
|
||||
ASIO_NOEXCEPT_IF(( \
|
||||
call_traits<R&, void(ASIO_VARIADIC_TARGS(n))>::is_noexcept)) \
|
||||
{ \
|
||||
return set_value(r, ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
} \
|
||||
\
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
ASIO_CONSTEXPR typename enable_if< \
|
||||
call_traits<const R&, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::overload == call_free, \
|
||||
typename call_traits<const R&, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::result_type \
|
||||
>::type \
|
||||
operator()(const R& r, ASIO_VARIADIC_MOVE_PARAMS(n)) const \
|
||||
ASIO_NOEXCEPT_IF(( \
|
||||
call_traits<const R&, void(ASIO_VARIADIC_TARGS(n))>::is_noexcept)) \
|
||||
{ \
|
||||
return set_value(r, ASIO_VARIADIC_MOVE_ARGS(n)); \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_SET_VALUE_CALL_DEF)
|
||||
#undef ASIO_PRIVATE_SET_VALUE_CALL_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_set_value_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_set_value_fn::impl&
|
||||
set_value = asio_execution_set_value_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
struct can_set_value :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_value_fn::call_traits<R, void(Vs...)>::overload !=
|
||||
asio_execution_set_value_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
constexpr bool can_set_value_v = can_set_value<R, Vs...>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
struct is_nothrow_set_value :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_value_fn::call_traits<R, void(Vs...)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R, typename... Vs>
|
||||
constexpr bool is_nothrow_set_value_v
|
||||
= is_nothrow_set_value<R, Vs...>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
template <typename R, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void>
|
||||
struct can_set_value;
|
||||
|
||||
template <typename R, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void,
|
||||
typename = void, typename = void, typename = void, typename = void>
|
||||
struct is_nothrow_set_value;
|
||||
|
||||
template <typename R>
|
||||
struct can_set_value<R> :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_value_fn::call_traits<R, void()>::overload !=
|
||||
asio_execution_set_value_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename R>
|
||||
struct is_nothrow_set_value<R> :
|
||||
integral_constant<bool,
|
||||
asio_execution_set_value_fn::call_traits<R, void()>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#define ASIO_PRIVATE_SET_VALUE_TRAITS_DEF(n) \
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
struct can_set_value<R, ASIO_VARIADIC_TARGS(n)> : \
|
||||
integral_constant<bool, \
|
||||
asio_execution_set_value_fn::call_traits<R, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::overload != \
|
||||
asio_execution_set_value_fn::ill_formed> \
|
||||
{ \
|
||||
}; \
|
||||
\
|
||||
template <typename R, ASIO_VARIADIC_TPARAMS(n)> \
|
||||
struct is_nothrow_set_value<R, ASIO_VARIADIC_TARGS(n)> : \
|
||||
integral_constant<bool, \
|
||||
asio_execution_set_value_fn::call_traits<R, \
|
||||
void(ASIO_VARIADIC_TARGS(n))>::is_noexcept> \
|
||||
{ \
|
||||
}; \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_SET_VALUE_TRAITS_DEF)
|
||||
#undef ASIO_PRIVATE_SET_VALUE_TRAITS_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_SET_VALUE_HPP
|
||||
247
extern/asio-1.18.2/include/asio/execution/start.hpp
vendored
Normal file
247
extern/asio-1.18.2/include/asio/execution/start.hpp
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
//
|
||||
// execution/start.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_START_HPP
|
||||
#define ASIO_EXECUTION_START_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/traits/start_member.hpp"
|
||||
#include "asio/traits/start_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that notifies an operation state object to start
|
||||
/// its associated operation.
|
||||
/**
|
||||
* The name <tt>execution::start</tt> denotes a customisation point object.
|
||||
* The expression <tt>execution::start(R)</tt> for some subexpression
|
||||
* <tt>R</tt> is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>R.start()</tt>, if that expression is valid.
|
||||
*
|
||||
* @li Otherwise, <tt>start(R)</tt>, if that expression is valid, with
|
||||
* overload resolution performed in a context that includes the declaration
|
||||
* <tt>void start();</tt> and that does not include a declaration of
|
||||
* <tt>execution::start</tt>.
|
||||
*
|
||||
* @li Otherwise, <tt>execution::start(R)</tt> is ill-formed.
|
||||
*/
|
||||
inline constexpr unspecified start = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c start expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_start is a trait that is derived from
|
||||
* @c true_type if the expression <tt>execution::start(std::declval<R>(),
|
||||
* std::declval<E>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename R>
|
||||
struct can_start :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_start_fn {
|
||||
|
||||
using asio::decay;
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::traits::start_free;
|
||||
using asio::traits::start_member;
|
||||
|
||||
void start();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename R, typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename R>
|
||||
struct call_traits<R,
|
||||
typename enable_if<
|
||||
start_member<R>::is_valid
|
||||
>::type> :
|
||||
start_member<R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename R>
|
||||
struct call_traits<R,
|
||||
typename enable_if<
|
||||
!start_member<R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
start_free<R>::is_valid
|
||||
>::type> :
|
||||
start_free<R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R>::overload == call_member,
|
||||
typename call_traits<R>::result_type
|
||||
>::type
|
||||
operator()(R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(R)(r).start();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R>::overload == call_free,
|
||||
typename call_traits<R>::result_type
|
||||
>::type
|
||||
operator()(R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R>::is_noexcept))
|
||||
{
|
||||
return start(ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&>::overload == call_member,
|
||||
typename call_traits<R&>::result_type
|
||||
>::type
|
||||
operator()(R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&>::is_noexcept))
|
||||
{
|
||||
return r.start();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&>::overload == call_member,
|
||||
typename call_traits<const R&>::result_type
|
||||
>::type
|
||||
operator()(const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&>::is_noexcept))
|
||||
{
|
||||
return r.start();
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<R&>::overload == call_free,
|
||||
typename call_traits<R&>::result_type
|
||||
>::type
|
||||
operator()(R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<R&>::is_noexcept))
|
||||
{
|
||||
return start(r);
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const R&>::overload == call_free,
|
||||
typename call_traits<const R&>::result_type
|
||||
>::type
|
||||
operator()(const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const R&>::is_noexcept))
|
||||
{
|
||||
return start(r);
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_start_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_start_fn::impl&
|
||||
start = asio_execution_start_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename R>
|
||||
struct can_start :
|
||||
integral_constant<bool,
|
||||
asio_execution_start_fn::call_traits<R>::overload !=
|
||||
asio_execution_start_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
constexpr bool can_start_v = can_start<R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
struct is_nothrow_start :
|
||||
integral_constant<bool,
|
||||
asio_execution_start_fn::call_traits<R>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename R>
|
||||
constexpr bool is_nothrow_start_v
|
||||
= is_nothrow_start<R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_START_HPP
|
||||
450
extern/asio-1.18.2/include/asio/execution/submit.hpp
vendored
Normal file
450
extern/asio-1.18.2/include/asio/execution/submit.hpp
vendored
Normal file
@@ -0,0 +1,450 @@
|
||||
//
|
||||
// execution/submit.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2021 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)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_SUBMIT_HPP
|
||||
#define ASIO_EXECUTION_SUBMIT_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/execution/detail/submit_receiver.hpp"
|
||||
#include "asio/execution/executor.hpp"
|
||||
#include "asio/execution/receiver.hpp"
|
||||
#include "asio/execution/sender.hpp"
|
||||
#include "asio/execution/start.hpp"
|
||||
#include "asio/traits/submit_member.hpp"
|
||||
#include "asio/traits/submit_free.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
#if defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// A customisation point that submits a sender to a receiver.
|
||||
/**
|
||||
* The name <tt>execution::submit</tt> denotes a customisation point object. For
|
||||
* some subexpressions <tt>s</tt> and <tt>r</tt>, let <tt>S</tt> be a type such
|
||||
* that <tt>decltype((s))</tt> is <tt>S</tt> and let <tt>R</tt> be a type such
|
||||
* that <tt>decltype((r))</tt> is <tt>R</tt>. The expression
|
||||
* <tt>execution::submit(s, r)</tt> is ill-formed if <tt>sender_to<S, R></tt> is
|
||||
* not <tt>true</tt>. Otherwise, it is expression-equivalent to:
|
||||
*
|
||||
* @li <tt>s.submit(r)</tt>, if that expression is valid and <tt>S</tt> models
|
||||
* <tt>sender</tt>. If the function selected does not submit the receiver
|
||||
* object <tt>r</tt> via the sender <tt>s</tt>, the program is ill-formed with
|
||||
* no diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>submit(s, r)</tt>, if that expression is valid and
|
||||
* <tt>S</tt> models <tt>sender</tt>, with overload resolution performed in a
|
||||
* context that includes the declaration <tt>void submit();</tt> and that does
|
||||
* not include a declaration of <tt>execution::submit</tt>. If the function
|
||||
* selected by overload resolution does not submit the receiver object
|
||||
* <tt>r</tt> via the sender <tt>s</tt>, the program is ill-formed with no
|
||||
* diagnostic required.
|
||||
*
|
||||
* @li Otherwise, <tt>execution::start((new submit_receiver<S,
|
||||
* R>{s,r})->state_)</tt>, where <tt>submit_receiver</tt> is an
|
||||
* implementation-defined class template equivalent to:
|
||||
* @code template<class S, class R>
|
||||
* struct submit_receiver {
|
||||
* struct wrap {
|
||||
* submit_receiver * p_;
|
||||
* template<class...As>
|
||||
* requires receiver_of<R, As...>
|
||||
* void set_value(As&&... as) &&
|
||||
* noexcept(is_nothrow_receiver_of_v<R, As...>) {
|
||||
* execution::set_value(std::move(p_->r_), (As&&) as...);
|
||||
* delete p_;
|
||||
* }
|
||||
* template<class E>
|
||||
* requires receiver<R, E>
|
||||
* void set_error(E&& e) && noexcept {
|
||||
* execution::set_error(std::move(p_->r_), (E&&) e);
|
||||
* delete p_;
|
||||
* }
|
||||
* void set_done() && noexcept {
|
||||
* execution::set_done(std::move(p_->r_));
|
||||
* delete p_;
|
||||
* }
|
||||
* };
|
||||
* remove_cvref_t<R> r_;
|
||||
* connect_result_t<S, wrap> state_;
|
||||
* submit_receiver(S&& s, R&& r)
|
||||
* : r_((R&&) r)
|
||||
* , state_(execution::connect((S&&) s, wrap{this})) {}
|
||||
* };
|
||||
* @endcode
|
||||
*/
|
||||
inline constexpr unspecified submit = unspecified;
|
||||
|
||||
/// A type trait that determines whether a @c submit expression is
|
||||
/// well-formed.
|
||||
/**
|
||||
* Class template @c can_submit is a trait that is derived from
|
||||
* @c true_type if the expression <tt>execution::submit(std::declval<R>(),
|
||||
* std::declval<E>())</tt> is well formed; otherwise @c false_type.
|
||||
*/
|
||||
template <typename S, typename R>
|
||||
struct can_submit :
|
||||
integral_constant<bool, automatically_determined>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#else // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
namespace asio_execution_submit_fn {
|
||||
|
||||
using asio::declval;
|
||||
using asio::enable_if;
|
||||
using asio::execution::is_sender_to;
|
||||
using asio::traits::submit_free;
|
||||
using asio::traits::submit_member;
|
||||
|
||||
void submit();
|
||||
|
||||
enum overload_type
|
||||
{
|
||||
call_member,
|
||||
call_free,
|
||||
adapter,
|
||||
ill_formed
|
||||
};
|
||||
|
||||
template <typename S, typename R, typename = void,
|
||||
typename = void, typename = void>
|
||||
struct call_traits
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = ill_formed);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
template <typename S, typename R>
|
||||
struct call_traits<S, void(R),
|
||||
typename enable_if<
|
||||
submit_member<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender_to<S, R>::value
|
||||
>::type> :
|
||||
submit_member<S, R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_member);
|
||||
};
|
||||
|
||||
template <typename S, typename R>
|
||||
struct call_traits<S, void(R),
|
||||
typename enable_if<
|
||||
!submit_member<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
submit_free<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender_to<S, R>::value
|
||||
>::type> :
|
||||
submit_free<S, R>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = call_free);
|
||||
};
|
||||
|
||||
template <typename S, typename R>
|
||||
struct call_traits<S, void(R),
|
||||
typename enable_if<
|
||||
!submit_member<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
!submit_free<S, R>::is_valid
|
||||
>::type,
|
||||
typename enable_if<
|
||||
is_sender_to<S, R>::value
|
||||
>::type>
|
||||
{
|
||||
ASIO_STATIC_CONSTEXPR(overload_type, overload = adapter);
|
||||
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
|
||||
typedef void result_type;
|
||||
};
|
||||
|
||||
struct impl
|
||||
{
|
||||
#if defined(ASIO_HAS_MOVE)
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(R)>::overload == call_member,
|
||||
typename call_traits<S, void(R)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(R)>::is_noexcept))
|
||||
{
|
||||
return ASIO_MOVE_CAST(S)(s).submit(ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(R)>::overload == call_free,
|
||||
typename call_traits<S, void(R)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(R)>::is_noexcept))
|
||||
{
|
||||
return submit(ASIO_MOVE_CAST(S)(s), ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S, void(R)>::overload == adapter,
|
||||
typename call_traits<S, void(R)>::result_type
|
||||
>::type
|
||||
operator()(S&& s, R&& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S, void(R)>::is_noexcept))
|
||||
{
|
||||
return asio::execution::start(
|
||||
(new asio::execution::detail::submit_receiver<S, R>(
|
||||
ASIO_MOVE_CAST(S)(s), ASIO_MOVE_CAST(R)(r)))->state_);
|
||||
}
|
||||
#else // defined(ASIO_HAS_MOVE)
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(R&)>::overload == call_member,
|
||||
typename call_traits<S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return s.submit(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(R&)>::overload == call_member,
|
||||
typename call_traits<const S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return s.submit(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(R&)>::overload == call_free,
|
||||
typename call_traits<S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return submit(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(R&)>::overload == call_free,
|
||||
typename call_traits<const S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return submit(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(R&)>::overload == adapter,
|
||||
typename call_traits<S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
return asio::execution::start(
|
||||
(new asio::execution::detail::submit_receiver<
|
||||
S&, R&>(s, r))->state_);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(R&)>::overload == adapter,
|
||||
typename call_traits<const S&, void(R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(R&)>::is_noexcept))
|
||||
{
|
||||
asio::execution::start(
|
||||
(new asio::execution::detail::submit_receiver<
|
||||
const S&, R&>(s, r))->state_);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(const R&)>::overload == call_member,
|
||||
typename call_traits<S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return s.submit(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(const R&)>::overload == call_member,
|
||||
typename call_traits<const S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return s.submit(r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(const R&)>::overload == call_free,
|
||||
typename call_traits<S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return submit(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(const R&)>::overload == call_free,
|
||||
typename call_traits<const S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
return submit(s, r);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<S&, void(const R&)>::overload == adapter,
|
||||
typename call_traits<S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
asio::execution::start(
|
||||
(new asio::execution::detail::submit_receiver<
|
||||
S&, const R&>(s, r))->state_);
|
||||
}
|
||||
|
||||
template <typename S, typename R>
|
||||
ASIO_CONSTEXPR typename enable_if<
|
||||
call_traits<const S&, void(const R&)>::overload == adapter,
|
||||
typename call_traits<const S&, void(const R&)>::result_type
|
||||
>::type
|
||||
operator()(const S& s, const R& r) const
|
||||
ASIO_NOEXCEPT_IF((
|
||||
call_traits<const S&, void(const R&)>::is_noexcept))
|
||||
{
|
||||
asio::execution::start(
|
||||
(new asio::execution::detail::submit_receiver<
|
||||
const S&, const R&>(s, r))->state_);
|
||||
}
|
||||
#endif // defined(ASIO_HAS_MOVE)
|
||||
};
|
||||
|
||||
template <typename T = impl>
|
||||
struct static_instance
|
||||
{
|
||||
static const T instance;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
const T static_instance<T>::instance = {};
|
||||
|
||||
} // namespace asio_execution_submit_fn
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
namespace {
|
||||
|
||||
static ASIO_CONSTEXPR const asio_execution_submit_fn::impl&
|
||||
submit = asio_execution_submit_fn::static_instance<>::instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
template <typename S, typename R>
|
||||
struct can_submit :
|
||||
integral_constant<bool,
|
||||
asio_execution_submit_fn::call_traits<S, void(R)>::overload !=
|
||||
asio_execution_submit_fn::ill_formed>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
constexpr bool can_submit_v = can_submit<S, R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
struct is_nothrow_submit :
|
||||
integral_constant<bool,
|
||||
asio_execution_submit_fn::call_traits<S, void(R)>::is_noexcept>
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
constexpr bool is_nothrow_submit_v
|
||||
= is_nothrow_submit<S, R>::value;
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
|
||||
|
||||
template <typename S, typename R>
|
||||
struct submit_result
|
||||
{
|
||||
typedef typename asio_execution_submit_fn::call_traits<
|
||||
S, void(R)>::result_type type;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename S, typename R>
|
||||
void submit_helper(ASIO_MOVE_ARG(S) s, ASIO_MOVE_ARG(R) r)
|
||||
{
|
||||
execution::submit(ASIO_MOVE_CAST(S)(s), ASIO_MOVE_CAST(R)(r));
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#endif // defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_SUBMIT_HPP
|
||||
Reference in New Issue
Block a user