coroutine 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_COROUTINE
  10. #define _LIBCPP_COROUTINE
  11. /**
  12. coroutine synopsis
  13. namespace std {
  14. // [coroutine.traits]
  15. template <class R, class... ArgTypes>
  16. struct coroutine_traits;
  17. // [coroutine.handle]
  18. template <class Promise = void>
  19. struct coroutine_handle;
  20. // [coroutine.handle.compare]
  21. constexpr bool operator==(coroutine_handle<> x, coroutine_handle<> y) noexcept;
  22. constexpr strong_ordering operator<=>(coroutine_handle<> x, coroutine_handle<> y) noexcept;
  23. // [coroutine.handle.hash]
  24. template <class T> struct hash;
  25. template <class P> struct hash<coroutine_handle<P>>;
  26. // [coroutine.noop]
  27. struct noop_coroutine_promise;
  28. template<> struct coroutine_handle<noop_coroutine_promise>;
  29. using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
  30. noop_coroutine_handle noop_coroutine() noexcept;
  31. // [coroutine.trivial.awaitables]
  32. struct suspend_never;
  33. struct suspend_always;
  34. } // namespace std
  35. */
  36. #include <__assert> // all public C++ headers provide the assertion handler
  37. #include <__config>
  38. #include <__coroutine/coroutine_handle.h>
  39. #include <__coroutine/coroutine_traits.h>
  40. #include <__coroutine/noop_coroutine_handle.h>
  41. #include <__coroutine/trivial_awaitables.h>
  42. #include <version>
  43. // standard-mandated includes
  44. // [coroutine.syn]
  45. #include <compare>
  46. #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
  47. # pragma GCC system_header
  48. #endif
  49. #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
  50. # include <iosfwd>
  51. # include <type_traits>
  52. #endif
  53. #endif // _LIBCPP_COROUTINE