Skip to content

Commit

Permalink
git format and fixed a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dietmarkuehl committed Jan 25, 2025
1 parent 9b15df6 commit 64f8353
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ list:
cmake --workflow --list-presets

format:
git clang-format
git clang-format main

test: compile
cd $(BUILDDIR); ctest
Expand Down
2 changes: 1 addition & 1 deletion examples/stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main() {
struct xstop_source_type { // remove the x to disable the stop token
static constexpr bool stop_possible() { return false; }
static constexpr void request_stop() {}
static constexpr beman::execution::never_stop_token get_token() { return {}; }
static constexpr beman::execution::never_stop_token get_token() { return {}; }
};
};

Expand Down
20 changes: 9 additions & 11 deletions include/beman/lazy/detail/any_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class any_scheduler {
virtual void complete_error(::std::error_code) = 0;
virtual void complete_error(::std::exception_ptr) = 0;
virtual void complete_stopped() = 0;
virtual ::beman::execution::inplace_stop_token get_stop_token() = 0;
virtual ::beman::execution::inplace_stop_token get_stop_token() = 0;
};

struct inner_state {
Expand Down Expand Up @@ -102,16 +102,14 @@ class any_scheduler {

std::remove_cvref_t<Receiver> receiver;
inner_state s;
::beman::execution::inplace_stop_source source;
::beman::execution::inplace_stop_source source;
::std::optional<callback_t> callback;

template <::beman::execution::receiver R, typename PS>
state(R&& r, PS& ps) : receiver(std::forward<R>(r)), s(ps->connect(this)) {}
void start() & noexcept { this->s.start(); }
void complete_value() override { ::beman::execution::set_value(std::move(this->receiver)); }
void complete_error(std::error_code err) override {
::beman::execution::set_error(std::move(receiver), err);
}
void complete_error(std::error_code err) override { ::beman::execution::set_error(std::move(receiver), err); }
void complete_error(std::exception_ptr ptr) override {
::beman::execution::set_error(std::move(receiver), std::move(ptr));
}
Expand All @@ -120,7 +118,7 @@ class any_scheduler {
if constexpr (::std::same_as<token_t, ::beman::execution::inplace_stop_token>) {
return ::beman::execution::get_stop_token(::beman::execution::get_env(this->receiver));
} else {
if constexpr (not ::std::same_as<token_t, ::beman::execution::never_stop_token>) {
if constexpr (not::std::same_as<token_t, ::beman::execution::never_stop_token>) {
if (not this->callback) {
this->callback.emplace(
::beman::execution::get_stop_token(::beman::execution::get_env(this->receiver)),
Expand All @@ -141,8 +139,8 @@ class any_scheduler {
env(const sender* s) : sndr(s) {}

public:
any_scheduler query(const ::beman::execution::get_completion_scheduler_t<::beman::execution::set_value_t>&)
const noexcept {
any_scheduler
query(const ::beman::execution::get_completion_scheduler_t<::beman::execution::set_value_t>&) const noexcept {
return this->sndr->inner_sender->get_completion_scheduler();
}
};
Expand Down Expand Up @@ -180,9 +178,9 @@ class any_scheduler {
using sender_concept = ::beman::execution::sender_t;
using completion_signatures =
::beman::execution::completion_signatures<::beman::execution::set_value_t(),
::beman::execution::set_error_t(std::error_code),
::beman::execution::set_error_t(std::exception_ptr),
::beman::execution::set_stopped_t()>;
::beman::execution::set_error_t(std::error_code),
::beman::execution::set_error_t(std::exception_ptr),
::beman::execution::set_stopped_t()>;

template <::beman::execution::scheduler S>
explicit sender(S&& s) : inner_sender(static_cast<concrete<S>*>(nullptr), std::forward<S>(s)) {}
Expand Down
2 changes: 1 addition & 1 deletion include/beman/lazy/detail/find_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Allocator find_allocator(const std::allocator_arg_t&) {
template <typename Allocator, typename Alloc, typename... A>
Allocator find_allocator(const std::allocator_arg_t&, const Alloc& alloc, const A&...) {
static_assert(
requires(const Alloc& alloc) { Allocator(alloc); },
requires(const Alloc& a) { Allocator(a); },
"The allocator needs to be constructible from the argument following std::allocator");
return Allocator(alloc);
}
Expand Down
3 changes: 1 addition & 2 deletions include/beman/lazy/detail/inline_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ namespace beman::lazy::detail {
struct inline_scheduler {
struct env {
inline_scheduler
query(const ::beman::execution::get_completion_scheduler_t<::beman::execution::set_value_t>&)
const noexcept {
query(const ::beman::execution::get_completion_scheduler_t<::beman::execution::set_value_t>&) const noexcept {
return {};
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/beman/lazy/detail/into_optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ inline constexpr struct into_optional_t : beman::execution::sender_adaptor_closu
template <typename... E, typename... S>
constexpr auto make_signatures(auto&& env, type_list<E...>, type_list<S...>) const {
return ::beman::execution::completion_signatures<::beman::execution::set_value_t(
decltype(this->get_type(env))),
::beman::execution::set_error_t(E)...,
S...>();
decltype(this->get_type(env))),
::beman::execution::set_error_t(E)...,
S...>();
}
template <typename Env>
auto get_completion_signatures(Env&& env) const {
Expand Down
6 changes: 3 additions & 3 deletions include/beman/lazy/detail/lazy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ struct lazy {
using sender_concept = ::beman::execution::sender_t;
using completion_signatures =
::beman::execution::completion_signatures<typename lazy_completion<T>::type,
::beman::execution::set_error_t(std::exception_ptr),
::beman::execution::set_error_t(std::error_code),
::beman::execution::set_stopped_t()>;
::beman::execution::set_error_t(std::exception_ptr),
::beman::execution::set_error_t(std::error_code),
::beman::execution::set_stopped_t()>;

struct state_base {
virtual void complete(typename lazy_promise_base<std::remove_cvref_t<T>>::result_t&) = 0;
Expand Down
3 changes: 1 addition & 2 deletions include/beman/lazy/detail/scheduler_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ template <typename Context>
requires requires { typename Context::scheduler_type; }
struct scheduler_of<Context> {
using type = typename Context::scheduler_type;
static_assert(::beman::execution::scheduler<type>,
"The type alias scheduler_type needs to refer to a scheduler");
static_assert(::beman::execution::scheduler<type>, "The type alias scheduler_type needs to refer to a scheduler");
};
template <typename Context>
using scheduler_of_t = typename scheduler_of<Context>::type;
Expand Down

0 comments on commit 64f8353

Please sign in to comment.