Skip to content

Commit 572ee73

Browse files
committed
Merge remote-tracking branch 'origin/master' into add_github_actions
2 parents 3a7438d + a87e97f commit 572ee73

File tree

10 files changed

+18
-15
lines changed

10 files changed

+18
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CppCoro - A coroutine library for C++
22

3-
The 'cppcoro' library provides a set of general-purpose primitives for making use of the coroutines TS proposal described in [N4680](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4680.pdf).
3+
The 'cppcoro' library provides a large set of general-purpose primitives for making use of the coroutines TS proposal described in [N4680](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4680.pdf).
44

55
These include:
66
* Coroutine Types
@@ -168,7 +168,7 @@ namespace cppcoro
168168
}
169169
```
170170

171-
You create a `task<T>` object by calling a coroutine function that returns
171+
You can create a `task<T>` object by calling a coroutine function that returns
172172
a `task<T>`.
173173

174174
The coroutine must contain a usage of either `co_await` or `co_return`.

include/cppcoro/cancellation_registration.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <utility>
1212
#include <type_traits>
1313
#include <atomic>
14+
#include <cstdint>
1415

1516
namespace cppcoro
1617
{

include/cppcoro/detail/sync_wait_task.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <experimental/coroutine>
1313
#include <cassert>
1414
#include <exception>
15+
#include <utility>
1516

1617
namespace cppcoro
1718
{

include/cppcoro/fmap.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ namespace cppcoro
2020
class fmap_awaiter
2121
{
2222
using awaiter_t = typename awaitable_traits<AWAITABLE&&>::awaiter_t;
23+
FUNC&& m_func;
24+
awaiter_t m_awaiter;
2325

2426
public:
2527

@@ -64,12 +66,6 @@ namespace cppcoro
6466
static_cast<FUNC&&>(m_func),
6567
static_cast<awaiter_t&&>(m_awaiter).await_resume());
6668
}
67-
68-
private:
69-
70-
FUNC&& m_func;
71-
awaiter_t m_awaiter;
72-
7369
};
7470

7571
template<typename FUNC, typename AWAITABLE>

include/cppcoro/generator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ namespace cppcoro
3232

3333
generator<T> get_return_object() noexcept;
3434

35-
constexpr std::experimental::suspend_always initial_suspend() const { return {}; }
36-
constexpr std::experimental::suspend_always final_suspend() const { return {}; }
35+
constexpr std::experimental::suspend_always initial_suspend() const noexcept { return {}; }
36+
constexpr std::experimental::suspend_always final_suspend() const noexcept { return {}; }
3737

3838
template<
3939
typename U = T,

include/cppcoro/resume_on.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ namespace cppcoro
117117
template<typename SCHEDULER, typename T>
118118
async_generator<T> resume_on(SCHEDULER& scheduler, async_generator<T> source)
119119
{
120-
for co_await(auto& value : source)
120+
for (auto iter = co_await source.begin(); iter != source.end(); co_await ++iter)
121121
{
122+
auto& value = *iter;
122123
co_await scheduler.schedule();
123124
co_yield value;
124125
}

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/doctest/doctest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4404,7 +4404,7 @@ namespace doctest
44044404
void addToContexts(IContextScope* ptr) { contextState->contexts.push_back(ptr); }
44054405
void popFromContexts() { contextState->contexts.pop_back(); }
44064406
void useContextIfExceptionOccurred(IContextScope* ptr) {
4407-
if (std::uncaught_exception()) {
4407+
if (std::uncaught_exceptions()) {
44084408
std::ostringstream stream;
44094409
ptr->build(&stream);
44104410
contextState->exceptionalContexts.push_back(stream.str());

test/file_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <random>
1717
#include <thread>
1818
#include <cassert>
19+
#include <string>
1920

2021
#include "io_service_fixture.hpp"
2122

test/scheduling_operator_tests.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ TEST_CASE_FIXTURE(io_service_fixture, "schedule_on async_generator<> function")
8787
auto seq = schedule_on(io_service(), makeSequence());
8888

8989
int expected = 1;
90-
for co_await(int value : seq)
90+
for (auto iter = co_await seq.begin(); iter != seq.end(); co_await ++iter)
9191
{
92+
int value = *iter;
9293
CHECK(value == expected++);
9394

9495
// Transfer exection back to main thread before
@@ -177,8 +178,9 @@ TEST_CASE_FIXTURE(io_service_fixture, "resume_on async_generator<> function"
177178
auto seq = resume_on(otherIoService, makeSequence());
178179

179180
int expected = 1;
180-
for co_await(int value : seq)
181+
for (auto iter = co_await seq.begin(); iter != seq.end(); co_await ++iter)
181182
{
183+
int value = *iter;
182184
// Every time we receive a value it should be on our requested
183185
// scheduler (ie. main thread)
184186
CHECK(std::this_thread::get_id() == mainThreadId);

0 commit comments

Comments
 (0)