Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion include/asio/awaitable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,20 @@ template <typename, typename> class awaitable_frame;

} // namespace detail

#if !defined(ASIO_AWAITABLE_FWD_DECL)
#define ASIO_AWAITABLE_FWD_DECL

// Forward declaration with defaulted arguments.
template <typename T, typename Executor = any_io_executor>
class awaitable;

#endif // !defined(ASIO_AWAITABLE_FWD_DECL)

/// The return type of a coroutine or asynchronous operation.
/**
* @sa @ref overview_cpp20_coroutines "C++20 coroutines support"
*/
template <typename T, typename Executor = any_io_executor>
template <typename T, typename Executor>
class ASIO_NODISCARD awaitable
{
public:
Expand Down
13 changes: 13 additions & 0 deletions include/asio/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ class any_completion_executor;

#endif // defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT)

#if defined(ASIO_HAS_CO_AWAIT)

#if !defined(ASIO_AWAITABLE_FWD_DECL)
#define ASIO_AWAITABLE_FWD_DECL

// Forward declaration with defaulted arguments.
template <typename T, typename Executor = any_io_executor>
class awaitable;

#endif // !defined(ASIO_AWAITABLE_FWD_DECL)

#endif // defined(ASIO_HAS_CO_AWAIT)

template <typename... Signatures>
class any_completion_handler;

Expand Down
4 changes: 4 additions & 0 deletions src/tests/unit/fwd_first.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
// Test that header file is self-contained.
#include "asio/fwd.hpp"

#if defined(ASIO_HAS_CO_AWAIT)
asio::awaitable<void> fwd_awaitable();
#endif // defined(ASIO_HAS_CO_AWAIT)

// Test that forward declarations don't conflict with full declarations.
#include "asio.hpp"

Expand Down