Insert placeholder declarations into winrt/base.h.

PiperOrigin-RevId: 495104919
This commit is contained in:
hai007
2022-12-13 13:09:29 -08:00
committed by Copybara-Service
parent db0aaf75d2
commit c5cb0e1d39
3 changed files with 70 additions and 0 deletions
@@ -35,6 +35,32 @@
#include <format>
#endif
#if defined(_LIBCPP_VERSION) && __cplusplus < 202002
// If the C++ standard is cxx17, coroutines are not available in libc++.
// To compile WinRT without coroutines, define some placeholder types.
// These placeholders should not be used. If they are used, they should fail.
template <typename T = void>
struct coroutine_handle {
coroutine_handle() { throw std::logic_error("Not implemented."); }
coroutine_handle(std::nullptr_t __h) {
throw std::logic_error("Not implemented.");
}
static coroutine_handle from_address(void*) {
throw std::logic_error("Not implemented.");
}
void operator()() const { throw std::logic_error("Not implemented."); }
void* address() const { throw std::logic_error("Not implemented."); }
};
class suspend_always {};
class suspend_never {};
template <typename _Result, typename...>
struct coroutine_traits;
} // namespace std::experimental
#endif
#ifdef __cpp_lib_coroutine
#include <coroutine>