Skip to content

Commit

Permalink
improv(coro): add [[nodiscard]] to dpp::task, dpp::coroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishura4 committed Jul 6, 2024
1 parent fb59bba commit 48d1dec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/dpp/coro/coroutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ using handle_t = std_coroutine::coroutine_handle<promise_t<R>>;
* @tparam R Return type of the coroutine. Can be void, or a complete object that supports move construction and move assignment.
*/
template <typename R>
class coroutine : public basic_awaitable<coroutine<R>> {
class [[nodiscard("dpp::coroutine only starts when it is awaited, it will do nothing if discarded")]] coroutine : public basic_awaitable<coroutine<R>> {
/**
* @brief Promise has friend access for the constructor
*/
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/coro/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ template <typename R>
#ifndef _DOXYGEN_
requires (!std::is_reference_v<R>)
#endif
class task : public awaitable<R> {
class [[nodiscard("dpp::task cancels itself on destruction. use co_await on it, or its sync_wait method")]] task : public awaitable<R> {
friend struct detail::task::promise_t<R>;

using handle_t = detail::task::handle_t<R>;
Expand Down

0 comments on commit 48d1dec

Please sign in to comment.