Sha256: dc5743e461bad1e01e931a007f3ff4f42b531f7b6230631d54739b6aa9fcfd7e

Contents?: true

Size: 1.84 KB

Versions: 6

Compression:

Stored size: 1.84 KB

Contents

//
// experimental/impl/use_promise.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2021-2023 Klemens D. Morgenstern
//                         (klemens dot morgenstern at gmx dot net)
//
// 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_EXPERIMENTAL_IMPL_USE_PROMISE_HPP
#define ASIO_EXPERIMENTAL_IMPL_USE_PROMISE_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include "asio/detail/config.hpp"
#include <memory>
#include "asio/async_result.hpp"

#include "asio/detail/push_options.hpp"

namespace asio {
namespace experimental {

template <typename Allocator>
struct use_promise_t;

namespace detail {

template<typename Signature, typename Executor, typename Allocator>
struct promise_handler;

} // namespace detail
} // namespace experimental

#if !defined(GENERATING_DOCUMENTATION)

template <typename Allocator, typename R, typename... Args>
struct async_result<experimental::use_promise_t<Allocator>, R(Args...)>
{
  template <typename Initiation, typename... InitArgs>
  static auto initiate(Initiation initiation,
      experimental::use_promise_t<Allocator> up, InitArgs... args)
    -> experimental::promise<void(decay_t<Args>...),
      asio::associated_executor_t<Initiation>, Allocator>
  {
    using handler_type = experimental::detail::promise_handler<
      void(decay_t<Args>...),
      asio::associated_executor_t<Initiation>, Allocator>;

    handler_type ht{up.get_allocator(), get_associated_executor(initiation)};
    std::move(initiation)(ht, std::move(args)...);
    return ht.make_promise();
  }
};

#endif // !defined(GENERATING_DOCUMENTATION)

} // namespace asio

#include "asio/detail/pop_options.hpp"

#endif // ASIO_EXPERIMENTAL_IMPL_USE_PROMISE_HPP

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
couchbase-3.5.6 ext/cache/asio/b710bc0ca14b231d20e983b02d27485125c7860e/asio/asio/include/asio/experimental/impl/use_promise.hpp
couchbase-3.5.5 ext/cache/asio/b710bc0ca14b231d20e983b02d27485125c7860e/asio/asio/include/asio/experimental/impl/use_promise.hpp
couchbase-3.5.4 ext/cache/asio/b710bc0ca14b231d20e983b02d27485125c7860e/asio/asio/include/asio/experimental/impl/use_promise.hpp
couchbase-3.5.3 ext/cache/asio/6a3b5a552ffb18a235024ec851619cfcb1337a98/asio/asio/include/asio/experimental/impl/use_promise.hpp
couchbase-3.5.2 ext/cache/asio/41f31469d0dd420500b334dc8c2fd3ffe7320d8e/asio/asio/include/asio/experimental/impl/use_promise.hpp
couchbase-3.5.1 ext/cache/asio/41f31469d0dd420500b334dc8c2fd3ffe7320d8e/asio/asio/include/asio/experimental/impl/use_promise.hpp