mirror of
https://github.com/Naios/continuable.git
synced 2025-12-07 01:06:44 +08:00
move completion token to cti namespace
This commit is contained in:
parent
f09fe50998
commit
87bf8c0bd9
@ -34,16 +34,21 @@
|
|||||||
#include <continuable/detail/support/asio.hpp>
|
#include <continuable/detail/support/asio.hpp>
|
||||||
#include <continuable/detail/utility/traits.hpp>
|
#include <continuable/detail/utility/traits.hpp>
|
||||||
|
|
||||||
|
namespace cti {
|
||||||
|
|
||||||
|
// Type used as an ASIO completion token to specify an asynchronous operation
|
||||||
|
// should return a continuable.
|
||||||
|
struct asio_token_t {};
|
||||||
|
|
||||||
|
// Special value for instance of `asio_token_t`.
|
||||||
|
constexpr asio_token_t asio_token{};
|
||||||
|
|
||||||
|
} // namespace cti
|
||||||
|
|
||||||
CTI_DETAIL_ASIO_NAMESPACE_BEGIN
|
CTI_DETAIL_ASIO_NAMESPACE_BEGIN
|
||||||
|
|
||||||
// Class used to specify an asynchronous operation should return a continuable.
|
|
||||||
struct use_cti_t {};
|
|
||||||
|
|
||||||
// Special value for instance of `use_cti_t`.
|
|
||||||
constexpr use_cti_t use_cti{};
|
|
||||||
|
|
||||||
template <typename Signature>
|
template <typename Signature>
|
||||||
class async_result<use_cti_t, Signature> {
|
class async_result<cti::asio_token_t, Signature> {
|
||||||
public:
|
public:
|
||||||
#if defined(CTI_DETAIL_ASIO_HAS_EXPLICIT_RET_TYPE_INTEGRATION)
|
#if defined(CTI_DETAIL_ASIO_HAS_EXPLICIT_RET_TYPE_INTEGRATION)
|
||||||
using return_type = typename cti::detail::asio::initiate_make_continuable<
|
using return_type = typename cti::detail::asio::initiate_make_continuable<
|
||||||
@ -51,7 +56,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Initiation, typename... Args>
|
template <typename Initiation, typename... Args>
|
||||||
static auto initiate(Initiation initiation, use_cti_t, Args... args) {
|
static auto initiate(Initiation initiation, cti::asio_token_t, Args... args) {
|
||||||
return cti::detail::asio::initiate_make_continuable<Signature>{}(
|
return cti::detail::asio::initiate_make_continuable<Signature>{}(
|
||||||
[initiation = std::move(initiation),
|
[initiation = std::move(initiation),
|
||||||
init_args =
|
init_args =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user