translate "for co_await" to regular for loops using "co_await" · DenisRitchie/cppcoro@fdb7a74 · GitHub
Skip to content

Commit fdb7a74

Browse files
andreasbuhrlewissbaker
authored andcommitted
translate "for co_await" to regular for loops using "co_await"
"for co_await" was in the coroutine-ts but did not make it into the C++20 standard. This patch translates the "for co_await" which were used to standard for loops using "co_await". This is necessary to compile on MSVC 1928 in with c++-latest.
1 parent a5ed331 commit fdb7a74

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

include/cppcoro/resume_on.hpp

Lines changed: 2 additions & 1 deletion

test/async_generator_tests.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,9 @@ TEST_CASE("large number of synchronous completions doesn't result in stack-overf
271271
auto consumer = [](cppcoro::async_generator<std::uint32_t> sequence) -> cppcoro::task<>
272272
{
273273
std::uint32_t expected = 0;
274-
for co_await(std::uint32_t i : sequence)
274+
for (auto iter = co_await sequence.begin(); iter != sequence.end(); co_await ++iter)
275275
{
276+
std::uint32_t i = *iter;
276277
CHECK(i == expected++);
277278
}
278279

test/scheduling_operator_tests.cpp

Lines changed: 4 additions & 2 deletions

0 commit comments

Comments
 (0)