// awaitable.hpp
// ~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 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)
# include <experimental/coroutine>
#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
+#include <utility>
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/detail/push_options.hpp>
/// The return type of a coroutine or asynchronous operation.
template <typename T, typename Executor = any_io_executor>
-class awaitable
+class BOOST_ASIO_NODISCARD awaitable
{
public:
/// The type of the awaited value.
frame_->destroy();
}
+ /// Move assignment.
+ awaitable& operator=(awaitable&& other) noexcept
+ {
+ if (this != &other)
+ frame_ = std::exchange(other.frame_, nullptr);
+ return *this;
+ }
+
/// Checks if the awaitable refers to a future result.
bool valid() const noexcept
{