File indexing completed on 2025-04-26 08:26:30
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_COBALT_NOOP_HPP
0009 #define BOOST_COBALT_NOOP_HPP
0010
0011 #include <type_traits>
0012 #include <utility>
0013
0014 namespace boost::cobalt
0015 {
0016
0017
0018
0019
0020 template<typename T = void>
0021 struct noop
0022 {
0023 template<typename ... Args>
0024 constexpr noop(Args && ... args) noexcept(std::is_nothrow_constructible_v<T, Args&&...>)
0025 : value(std::forward<Args>(args)...)
0026 {
0027 }
0028
0029 T value;
0030
0031 constexpr static bool await_ready() {return true;}
0032 template<typename P>
0033 constexpr static void await_suspend(std::coroutine_handle<P>) {}
0034 constexpr T await_resume() {return std::move(value);}
0035
0036
0037 };
0038
0039
0040 template<> struct noop<void>
0041 {
0042 constexpr static bool await_ready() {return true;}
0043 template<typename P>
0044 constexpr static void await_suspend(std::coroutine_handle<P>) {}
0045 constexpr static void await_resume() {}
0046 };
0047
0048
0049 template<typename T> noop( T &&) -> noop<T>;
0050 template<typename T> noop(const T & ) -> noop<T>;
0051 noop() -> noop<void>;
0052
0053 }
0054
0055 #endif