Skip to content

Commit ed1079a

Browse files
authored
Define co_await operators for C++20 coroutines as well (#764) (#765)
1 parent 714c085 commit ed1079a

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

strings/base_coroutine_foundation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ namespace winrt::impl
223223
}
224224
}
225225

226-
#ifdef __cpp_coroutines
226+
#ifdef WINRT_IMPL_COROUTINES
227227
WINRT_EXPORT namespace winrt::Windows::Foundation
228228
{
229229
inline impl::await_adapter<IAsyncAction> operator co_await(IAsyncAction const& async)

strings/base_coroutine_system.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ WINRT_EXPORT namespace winrt
4141
return awaitable{ dispatcher, priority };
4242
};
4343

44-
#ifdef __cpp_coroutines
44+
#ifdef WINRT_IMPL_COROUTINES
4545
inline auto operator co_await(Windows::System::DispatcherQueue const& dispatcher)
4646
{
4747
return resume_foreground(dispatcher);

strings/base_coroutine_system_winui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ WINRT_EXPORT namespace winrt
4141
return awaitable{ dispatcher, priority };
4242
};
4343

44-
#ifdef __cpp_coroutines
44+
#ifdef WINRT_IMPL_COROUTINES
4545
inline auto operator co_await(Microsoft::System::DispatcherQueue const& dispatcher)
4646
{
4747
return resume_foreground(dispatcher);

strings/base_coroutine_threadpool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ WINRT_EXPORT namespace winrt
442442
return awaitable{ duration };
443443
}
444444

445-
#ifdef __cpp_coroutines
445+
#ifdef WINRT_IMPL_COROUTINES
446446
inline auto operator co_await(Windows::Foundation::TimeSpan duration)
447447
{
448448
return resume_after(duration);

strings/base_coroutine_ui_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ WINRT_EXPORT namespace winrt
3939
return awaitable{ dispatcher, priority };
4040
};
4141

42-
#ifdef __cpp_coroutines
42+
#ifdef WINRT_IMPL_COROUTINES
4343
inline auto operator co_await(Windows::UI::Core::CoreDispatcher const& dispatcher)
4444
{
4545
return resume_foreground(dispatcher);

strings/base_deferral.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
WINRT_EXPORT namespace winrt
33
{
4-
#ifdef __cpp_coroutines
4+
#ifdef WINRT_IMPL_COROUTINES
55
template<typename D>
66
struct deferrable_event_args
77
{

strings/base_macros.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
// Note: this is a workaround for a false-positive warning produced by the Visual C++ 16.3 compiler.
2828
#pragma warning(disable : 4268)
2929

30-
#if defined(_RESUMABLE_FUNCTIONS_SUPPORTED) && !defined(__cpp_coroutines)
31-
#define __cpp_coroutines
30+
#if defined(__cpp_lib_coroutine) || defined(__cpp_coroutines) || defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
31+
#define WINRT_IMPL_COROUTINES
3232
#endif
3333

3434
#ifndef WINRT_EXPORT

0 commit comments

Comments
 (0)