最終更新日時(UTC):
が更新

履歴 編集

function
<coroutine>

std::coroutine_handle::operator bool(C++20)

constexpr explicit operator bool() const noexcept;

概要

コルーチンハンドルが有効なコルーチンを指すかを確認する。

戻り値

address() != nullptr

例外

投げない

#include <coroutine>
#include <iostream>

int main()
{
  std::coroutine_handle<> h;
  if (h) {
    std::cout << "valid coroutine" << std::endl;
  } else {
    std::cout << "empty coroutine" << std::endl;
  }
}

出力

empty coroutine

バージョン

言語

  • C++20

処理系

関連項目