Initial commit
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user