Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/capy_stream_await.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class StreamIoAwaitable {
public:
StreamIoAwaitable(cudaStream_t stream) : m_stream(stream) {}
explicit StreamIoAwaitable(cudaStream_t stream) : m_stream(stream) {}

bool await_ready() const noexcept { return false; }

Expand Down
2 changes: 1 addition & 1 deletion examples/capy_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ template <boost::capy::Executor Ex>
class VerboseExecutor {

public:
VerboseExecutor(Ex& ex) : m_executor(&ex) {
explicit VerboseExecutor(Ex& ex) : m_executor(&ex) {
static_assert(boost::capy::Executor<VerboseExecutor<Ex>>,
"VerboseExecutor should be a valid capy Executor");
}
Expand Down
4 changes: 2 additions & 2 deletions examples/capy_task_arena_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class TaskArenaContext : public boost::capy::execution_context {
public:
TaskArenaContext(tbb::task_arena& arena) : m_arena(&arena) {}
explicit TaskArenaContext(tbb::task_arena& arena) : m_arena(&arena) {}

void schedule(std::coroutine_handle<> h) const {
m_arena->enqueue([h]() { h.resume(); });
Expand All @@ -23,7 +23,7 @@ class TaskArenaContext : public boost::capy::execution_context {
class TaskArenaExecutor {

public:
TaskArenaExecutor(TaskArenaContext& context) noexcept
explicit TaskArenaExecutor(TaskArenaContext& context) noexcept
: m_context(&context) {
static_assert(boost::capy::Executor<TaskArenaExecutor>,
"TaskArenaExecutor should be a valid capy Executor");
Expand Down
3 changes: 2 additions & 1 deletion examples/exec_stream_await_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class stream_await_sender {
using completion_signatures =
stdexec::completion_signatures<stdexec::set_value_t(cudaError_t)>;

stream_await_sender(const cudaStream_t stream) : m_stream(stream) {}
explicit stream_await_sender(const cudaStream_t stream)
: m_stream(stream) {}
stdexec::env<> get_env() const noexcept { return {}; }

template <stdexec::receiver Receiver>
Expand Down
5 changes: 3 additions & 2 deletions include/CoroutineTests/alien/algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class [[nodiscard]] Task {
using scheduler_type = std::function<void(std::coroutine_handle<>)>;

// Required by coroutines
Task(handle_type coroutine_handle) : m_coroutine(coroutine_handle) {}
explicit Task(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {}
~Task() {
if (m_coroutine) {
m_coroutine.destroy();
Expand Down Expand Up @@ -100,7 +101,7 @@ struct Task<ResultType>::promise_type {
const auto& get_scheduler() const { return m_scheduler; }

// Required by coroutines: create the object
Task get_return_object() { return {handle_type::from_promise(*this)}; }
Task get_return_object() { return Task{handle_type::from_promise(*this)}; }
// Required by coroutines: suspend immediately on start (lazy execution)
std::suspend_always initial_suspend() const noexcept { return {}; }
// Required by coroutines: suspend on completion
Expand Down
5 changes: 3 additions & 2 deletions include/CoroutineTests/alien/manual_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class [[nodiscard]] Task {
using scheduler_type = std::function<void(std::coroutine_handle<>)>;

// Required by coroutines
Task(handle_type coroutine_handle) : m_coroutine(coroutine_handle) {}
explicit Task(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {}
~Task() {
if (m_coroutine) {
m_coroutine.destroy();
Expand Down Expand Up @@ -100,7 +101,7 @@ struct Task<ResultType>::promise_type {
const auto& get_scheduler() const { return m_scheduler; }

// Required by coroutines: create the object
Task get_return_object() { return {handle_type::from_promise(*this)}; }
Task get_return_object() { return Task{handle_type::from_promise(*this)}; }
// Required by coroutines: suspend immediately on start (lazy execution)
std::suspend_always initial_suspend() const noexcept { return {}; }
// Required by coroutines: suspend on completion
Expand Down
5 changes: 3 additions & 2 deletions include/CoroutineTests/alien/schedule_on.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class [[nodiscard]] Task {
std::coroutine_handle<promise_type>; // not required but useful

// Constructor from coroutine handle
Task(handle_type coroutine_handle) : m_coroutine(coroutine_handle) {}
explicit Task(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {}
~Task() {
if (m_coroutine) {
m_coroutine.destroy();
Expand Down Expand Up @@ -122,7 +123,7 @@ struct Task<ResultType>::promise_type
void reschedule() { m_scheduler(handle_type::from_promise(*this)); }

// Required by coroutines: create the object
Task get_return_object() { return {handle_type::from_promise(*this)}; }
Task get_return_object() { return Task{handle_type::from_promise(*this)}; }
// Required by coroutines: suspend immediately on start (lazy execution)
std::suspend_always initial_suspend() const { return {}; }
// Required by coroutines: handle completion and resume parent
Expand Down
5 changes: 3 additions & 2 deletions include/CoroutineTests/alien/subtool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class [[nodiscard]] Task {
std::coroutine_handle<promise_type>; // not required but useful

// Constructor from coroutine handle
Task(handle_type coroutine_handle) : m_coroutine(coroutine_handle) {}
explicit Task(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {}
~Task() {
if (m_coroutine) {
m_coroutine.destroy();
Expand Down Expand Up @@ -145,7 +146,7 @@ struct Task<ResultType>::promise_type
void reschedule() { m_scheduler(handle_type::from_promise(*this)); }

// Required by coroutines: create the object
Task get_return_object() { return {handle_type::from_promise(*this)}; }
Task get_return_object() { return Task{handle_type::from_promise(*this)}; }
// Required by coroutines: suspend immediately on start (lazy execution)
std::suspend_always initial_suspend() const { return {}; }
// Required by coroutines: handle completion and resume parent
Expand Down
5 changes: 3 additions & 2 deletions include/CoroutineTests/alien/tool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class [[nodiscard]] Task {
std::coroutine_handle<promise_type>; // not required but useful

// Constructor from coroutine handle
Task(handle_type coroutine_handle) : m_coroutine(coroutine_handle) {}
explicit Task(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {}
~Task() {
if (m_coroutine) {
m_coroutine.destroy();
Expand Down Expand Up @@ -145,7 +146,7 @@ struct Task<ResultType>::promise_type
void reschedule() { m_scheduler(handle_type::from_promise(*this)); }

// Required by coroutines: create the object
Task get_return_object() { return {handle_type::from_promise(*this)}; }
Task get_return_object() { return Task{handle_type::from_promise(*this)}; }
// Required by coroutines: suspend immediately on start (lazy execution)
std::suspend_always initial_suspend() const { return {}; }
// Required by coroutines: handle completion and resume parent
Expand Down
4 changes: 2 additions & 2 deletions include/CoroutineTests/async.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class [[nodiscard]] Async {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

Async(handle_type coroutine_handle)
explicit Async(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~Async() {
if (m_coroutine) {
Expand Down Expand Up @@ -71,7 +71,7 @@ struct Async::promise_type {
}
// required by coroutines
Async get_return_object() {
return {Async::handle_type::from_promise(*this)};
return Async{Async::handle_type::from_promise(*this)};
}
// called on coroutine start
std::suspend_always initial_suspend() const { return {}; }
Expand Down
4 changes: 2 additions & 2 deletions include/CoroutineTests/datasink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class [[nodiscard]] DataSink {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

DataSink(handle_type coroutine_handle)
explicit DataSink(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~DataSink() {
if (m_coroutine) {
Expand Down Expand Up @@ -61,7 +61,7 @@ struct DataSink<T>::promise_type {

// required by coroutines
DataSink get_return_object() {
return {DataSink::handle_type::from_promise(*this)};
return DataSink{DataSink::handle_type::from_promise(*this)};
}
// called on coroutine start
// resume immediately and proceed to first co_await
Expand Down
6 changes: 3 additions & 3 deletions include/CoroutineTests/datasource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class [[nodiscard]] DataSource {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

DataSource(handle_type coroutine_handle)
explicit DataSource(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~DataSource() {
if (m_coroutine) {
Expand Down Expand Up @@ -68,7 +68,7 @@ struct DataSource<T>::promise_type {

// required by coroutines
DataSource get_return_object() {
return {DataSource::handle_type::from_promise(*this)};
return DataSource{DataSource::handle_type::from_promise(*this)};
}
// called on coroutine start
std::suspend_always initial_suspend() const { return {}; }
Expand All @@ -85,7 +85,7 @@ struct DataSource<T>::promise_type {
// This could be potentially replaced by just co_yield
template <typename T>
struct OutputAwaiter {
OutputAwaiter(T value) : m_value(value) {}
explicit OutputAwaiter(T value) : m_value(value) {}
T m_value;
// don't resume immediately
bool await_ready() const { return false; }
Expand Down
6 changes: 3 additions & 3 deletions include/CoroutineTests/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class [[nodiscard]] Generator
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

Generator(handle_type coroutine_handle)
explicit Generator(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~Generator() {
if (m_coroutine) {
Expand Down Expand Up @@ -61,8 +61,8 @@ struct Generator<T>::promise_type {
T m_current_value;
std::exception_ptr m_exception;
// required by coroutines
Generator<T> get_return_object() {
return {Generator<T>::handle_type::from_promise(*this)};
Generator get_return_object() {
return Generator{Generator<T>::handle_type::from_promise(*this)};
}
// called on coroutine start
std::suspend_always initial_suspend() const { return {}; }
Expand Down
6 changes: 3 additions & 3 deletions include/CoroutineTests/lazy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class [[nodiscard]] MaybeLazy {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

MaybeLazy(handle_type coroutine_handle)
explicit MaybeLazy(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~MaybeLazy() {
if (m_coroutine) {
Expand Down Expand Up @@ -61,8 +61,8 @@ struct MaybeLazy<T, is_lazy>::promise_type {
T m_current_value;
std::exception_ptr m_exception;
// required by coroutines
MaybeLazy<T, is_lazy> get_return_object() {
return {MaybeLazy<T, is_lazy>::handle_type::from_promise(*this)};
MaybeLazy get_return_object() {
return MaybeLazy{MaybeLazy::handle_type::from_promise(*this)};
}
// called on coroutine start
auto initial_suspend() const {
Expand Down
4 changes: 2 additions & 2 deletions include/CoroutineTests/nestabletask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class [[nodiscard]] NestableTask {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

NestableTask(handle_type coroutine_handle)
explicit NestableTask(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~NestableTask() {
if (m_coroutine) {
Expand Down Expand Up @@ -62,7 +62,7 @@ struct NestableTask::promise_type {
handle_type m_parent;
// required by coroutines
NestableTask get_return_object() {
return {NestableTask::handle_type::from_promise(*this)};
return NestableTask{NestableTask::handle_type::from_promise(*this)};
}
// called on coroutine start
std::suspend_always initial_suspend() const { return {}; }
Expand Down
4 changes: 2 additions & 2 deletions include/CoroutineTests/pingpong.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class [[nodiscard]] Player {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

Player(handle_type coroutine_handle)
explicit Player(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~Player() {
if (m_coroutine) {
Expand Down Expand Up @@ -54,7 +54,7 @@ struct Player::promise_type {
handle_type m_peer;
// required by coroutines
Player get_return_object() {
return {Player::handle_type::from_promise(*this)};
return Player{Player::handle_type::from_promise(*this)};
}
// called on coroutine start
std::suspend_always initial_suspend() const { return {}; }
Expand Down
5 changes: 3 additions & 2 deletions include/CoroutineTests/simplegenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class [[nodiscard]] SimpleGenerator {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

SimpleGenerator(handle_type coroutine_handle)
explicit SimpleGenerator(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~SimpleGenerator() {
if (m_coroutine) {
Expand Down Expand Up @@ -64,7 +64,8 @@ struct SimpleGenerator<T>::promise_type {
T m_value{};
// required by coroutines
SimpleGenerator get_return_object() {
return {SimpleGenerator::handle_type::from_promise(*this)};
return SimpleGenerator{
SimpleGenerator::handle_type::from_promise(*this)};
}
// called on coroutine start
std::suspend_always initial_suspend() const { return {}; }
Expand Down
4 changes: 2 additions & 2 deletions include/CoroutineTests/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class [[nodiscard]] Task {
using handle_type =
std::coroutine_handle<promise_type>; // not required but useful

Task(handle_type coroutine_handle)
explicit Task(handle_type coroutine_handle)
: m_coroutine(coroutine_handle) {} // required by coroutines
~Task() {
if (m_coroutine) {
Expand Down Expand Up @@ -50,7 +50,7 @@ struct Task::promise_type {
std::exception_ptr m_exception;
// required by coroutines
Task get_return_object() {
return {Task::handle_type::from_promise(*this)};
return Task{Task::handle_type::from_promise(*this)};
}
// called on coroutine start
std::suspend_always initial_suspend() const { return {}; }
Expand Down