Skip to content

Commit

Permalink
fixed more compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dietmarkuehl committed Dec 22, 2024
1 parent a38953d commit 0ba823e
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 122 deletions.
12 changes: 6 additions & 6 deletions examples/allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace {
template <std::size_t Size>
struct inline_resource : std::pmr::memory_resource {
const char* name;
explicit inline_resource(const char* name) : name(name) {}
explicit inline_resource(const char* n) : name(n) {}
std::byte buffer[Size]{}; // NOLINT(hicpp-avoid-c-arrays)
std::byte* next{+this->buffer}; // NOLINT(hicpp-no-array-decay)

Expand All @@ -39,13 +39,13 @@ struct allocator_aware_fun {

template <typename F>
requires std::same_as<std::remove_cvref_t<F>, std::remove_cvref_t<Fun>>
explicit allocator_aware_fun(F&& fun) : fun(std::forward<F>(fun)) {}
allocator_aware_fun(const allocator_aware_fun& other, allocator_type allocator = {})
: fun(other.fun), allocator(allocator) {}
explicit allocator_aware_fun(F&& f) : fun(std::forward<F>(f)) {}
allocator_aware_fun(const allocator_aware_fun& other, allocator_type alloc = {})
: fun(other.fun), allocator(alloc) {}
allocator_aware_fun(allocator_aware_fun&& other) noexcept
: fun(std::move(other.fun)), allocator(other.allocator) {}
allocator_aware_fun(allocator_aware_fun&& other, allocator_type allocator)
: fun(std::move(other.fun)), allocator(allocator) {}
allocator_aware_fun(allocator_aware_fun&& other, allocator_type alloc)
: fun(std::move(other.fun)), allocator(alloc) {}

template <typename... Args>
auto operator()(Args&&... args) noexcept {
Expand Down
6 changes: 6 additions & 0 deletions examples/doc-just_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
#include <cassert>
namespace ex = beman::execution26;

namespace {
void use(auto&&...) {}
} // namespace

int main() {
bool had_error{false};
auto result = ex::sync_wait(ex::just_error(std::error_code(17, std::system_category())) |
ex::upon_error([&](std::error_code ec) {
use(ec);
assert(ec.value() == 17);
had_error = true;
}));
use(result, had_error);
assert(result);
assert(had_error);
}
5 changes: 5 additions & 0 deletions examples/doc-just_stopped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
#include <iostream> //-dk:TODO remove
namespace ex = beman::execution26;

namespace {
void use(auto&&...) {}
} // namespace

int main() {
bool stopped{false};

auto result = ex::sync_wait(ex::just_stopped() | ex::upon_stopped([&] { stopped = true; }));
use(result, stopped);
assert(result);
assert(stopped);
}
4 changes: 2 additions & 2 deletions examples/sender-demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ struct just_op_state {
std::pmr::string value;

template <typename R>
just_op_state(R&& r, std::pmr::string&& value)
: rec(std::forward<R>(r)), value(std::move(value), ex::get_allocator(ex::get_env(rec))) {}
just_op_state(R&& r, std::pmr::string&& val)
: rec(std::forward<R>(r)), value(std::move(val), ex::get_allocator(ex::get_env(rec))) {}

void start() & noexcept { ex::set_value(std::move(rec), std::move(value)); }
};
Expand Down
4 changes: 2 additions & 2 deletions examples/stopping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace {
struct env {
ex::inplace_stop_token token;

env(ex::inplace_stop_token token) : token(token) {} // NOLINT(hicpp-explicit-conversions)
explicit env(ex::inplace_stop_token t) : token(t) {} // NOLINT(hicpp-explicit-conversions)

auto query(const ex::get_stop_token_t&) const noexcept { return this->token; }
};
Expand All @@ -38,7 +38,7 @@ struct inject_cancel_sender {
std::remove_cvref_t<Receiver> inner_receiver;
ex::inplace_stop_token token{};

auto get_env() const noexcept -> env { return {this->token}; }
auto get_env() const noexcept -> env { return env(this->token); }

template <typename... T>
auto set_value(T&&... t) noexcept -> void {
Expand Down
2 changes: 1 addition & 1 deletion tests/beman/execution26/exec-let.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace ex = test_std;
struct fun {
std::pmr::polymorphic_allocator<> allocator{};
fun() {}
explicit fun(std::pmr::polymorphic_allocator<> allocator) : allocator(allocator) {}
explicit fun(std::pmr::polymorphic_allocator<> alloc) : allocator(alloc) {}
auto operator()(std::span<int> s) noexcept {
return ex::just(std::pmr::vector<int>(s.begin(), s.end(), this->allocator));
}
Expand Down
Loading

0 comments on commit 0ba823e

Please sign in to comment.