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
45 changes: 32 additions & 13 deletions include/exec/any_sender_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
#pragma once

#include "../stdexec/__detail/__any_receiver_ref.hpp"
#include "../stdexec/execution.hpp"

#include "sequence_senders.hpp"
Expand All @@ -27,6 +26,26 @@ namespace exec {
namespace __any {
using namespace STDEXEC;

template <class _Sig>
struct __rcvr_vfun;

template <class _Tag, class... _Args>
struct __rcvr_vfun<_Tag(_Args...)> {
void (*__complete_)(void*, _Args...) noexcept;

void operator()(void* __obj, _Tag, _Args... __args) const noexcept {
__complete_(__obj, static_cast<_Args&&>(__args)...);
}
};

template <class _GetReceiver = std::identity, class _Obj, class _Tag, class... _Args>
constexpr auto __rcvr_vfun_fn(_Obj*, _Tag (*)(_Args...)) noexcept {
return +[](void* __ptr, _Args... __args) noexcept {
_Obj* __obj = static_cast<_Obj*>(__ptr);
_Tag()(std::move(_GetReceiver()(*__obj)), static_cast<_Args&&>(__args)...);
};
}

struct __create_vtable_t {
template <class _VTable, class _Tp>
constexpr auto operator()(__mtype<_VTable>, __mtype<_Tp>) const noexcept -> const _VTable* {
Expand Down Expand Up @@ -656,19 +675,19 @@ namespace exec {
template <class... _Sigs, class... _Queries>
struct __vtable<completion_signatures<_Sigs...>, _Queries...> {
struct __t
: __overload<__any_::__rcvr_vfun<_Sigs>...>
: __overload<__rcvr_vfun<_Sigs>...>
, __query_vfun<_Queries>... {
using __query_vfun<_Queries>::operator()...;

template <class _Tag, class... _As>
requires __one_of<_Tag(_As...), _Sigs...>
|| __callable<__overload<__any_::__rcvr_vfun<_Sigs>...>, void*, _Tag, _As...>
|| __callable<__overload<__rcvr_vfun<_Sigs>...>, void*, _Tag, _As...>
void operator()(void* __rcvr, _Tag, _As&&... __as) const noexcept {
if constexpr (__one_of<_Tag(_As...), _Sigs...>) {
const __any_::__rcvr_vfun<_Tag(_As...)>& __vfun = *this;
const __rcvr_vfun<_Tag(_As...)>& __vfun = *this;
__vfun(__rcvr, _Tag(), static_cast<_As&&>(__as)...);
} else {
const __overload<__any_::__rcvr_vfun<_Sigs>...>& __vfun = *this;
const __overload<__rcvr_vfun<_Sigs>...>& __vfun = *this;
__vfun(__rcvr, _Tag(), static_cast<_As&&>(__as)...);
}
}
Expand All @@ -678,7 +697,7 @@ namespace exec {
&& (__callable<__query_vfun_fn<_Rcvr>, _Queries> && ...)
static auto __create_vtable(__mtype<_Rcvr>) noexcept -> const __t* {
static const __t __vtable_{
{{__any_::__rcvr_vfun_fn(
{{__rcvr_vfun_fn(
static_cast<_Rcvr*>(nullptr), static_cast<_Sigs*>(nullptr))}...},
{__query_vfun_fn<_Rcvr>{}(static_cast<_Queries>(nullptr))}...};
return &__vtable_;
Expand Down Expand Up @@ -791,34 +810,34 @@ namespace exec {

template <class... _As>
requires __one_of<set_value_t(_As...), _Sigs...>
|| __callable<__overload<__any_::__rcvr_vfun<_Sigs>...>, void*, set_value_t, _As...>
|| __callable<__overload<__rcvr_vfun<_Sigs>...>, void*, set_value_t, _As...>
void set_value(_As&&... __as) noexcept {
if constexpr (__one_of<set_value_t(_As...), _Sigs...>) {
const __any_::__rcvr_vfun<set_value_t(_As...)>& __vfun = *__env_.__vtable_;
const __rcvr_vfun<set_value_t(_As...)>& __vfun = *__env_.__vtable_;
__vfun(__env_.__rcvr_, set_value_t(), static_cast<_As&&>(__as)...);
} else {
const __overload<__any_::__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
const __overload<__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
__vfun(__env_.__rcvr_, set_value_t(), static_cast<_As&&>(__as)...);
}
}

template <class _Error>
requires __one_of<set_error_t(_Error), _Sigs...>
|| __callable<__overload<__any_::__rcvr_vfun<_Sigs>...>, void*, set_error_t, _Error>
|| __callable<__overload<__rcvr_vfun<_Sigs>...>, void*, set_error_t, _Error>
void set_error(_Error&& __err) noexcept {
if constexpr (__one_of<set_error_t(_Error), _Sigs...>) {
const __any_::__rcvr_vfun<set_error_t(_Error)>& __vfun = *__env_.__vtable_;
const __rcvr_vfun<set_error_t(_Error)>& __vfun = *__env_.__vtable_;
__vfun(__env_.__rcvr_, set_error_t(), static_cast<_Error&&>(__err));
} else {
const __overload<__any_::__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
const __overload<__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
__vfun(__env_.__rcvr_, set_error_t(), static_cast<_Error&&>(__err));
}
}

void set_stopped() noexcept
requires __one_of<set_stopped_t(), _Sigs...>
{
const __any_::__rcvr_vfun<set_stopped_t()>& __vfun = *__env_.__vtable_;
const __rcvr_vfun<set_stopped_t()>& __vfun = *__env_.__vtable_;
__vfun(__env_.__rcvr_, set_stopped_t());
}

Expand Down
6 changes: 3 additions & 3 deletions include/exec/sequence/any_sequence_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace exec {

struct __t
: public __rcvr_next_vfun<_NextSigs>
, public __any_::__rcvr_vfun<_Sigs>...
, public __rcvr_vfun<_Sigs>...
, public __query_vfun<_Queries>... {
using __id = __next_vtable;
using __query_vfun<_Queries>::operator()...;
Expand All @@ -71,7 +71,7 @@ namespace exec {
static auto __create_vtable(__mtype<_Rcvr>) noexcept -> const __t* {
static const __t __vtable_{
{__rcvr_next_vfun_fn<_Rcvr>{}(static_cast<_NextSigs*>(nullptr))},
{__any_::__rcvr_vfun_fn(
{__rcvr_vfun_fn(
static_cast<_Rcvr*>(nullptr), static_cast<_Sigs*>(nullptr))}...,
{__query_vfun_fn<_Rcvr>{}(static_cast<_Queries>(nullptr))}...};
return &__vtable_;
Expand Down Expand Up @@ -116,7 +116,7 @@ namespace exec {
using __vtable_t = STDEXEC::__t<__next_vtable<__next_sigs, __sigs, _Queries...>>;

template <class Sig>
using __vfun = __any_::__rcvr_vfun<Sig>;
using __vfun = __rcvr_vfun<Sig>;

using __env_t = STDEXEC::__t<__env<__next_sigs, _Queries...>>;
__env_t __env_;
Expand Down
120 changes: 0 additions & 120 deletions include/stdexec/__detail/__any_receiver_ref.hpp

This file was deleted.

1 change: 0 additions & 1 deletion include/stdexec/__detail/__let.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "__execution_fwd.hpp"

// include these after __execution_fwd.hpp
#include "__any_receiver_ref.hpp" // IWYU pragma: keep for __any::__receiver_ref
#include "__basic_sender.hpp"
#include "__diagnostics.hpp"
#include "__domain.hpp"
Expand Down
4 changes: 2 additions & 2 deletions include/stdexec/__detail/__task_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ namespace STDEXEC {

void schedule(
system_context_replaceability::receiver_proxy& __rcvr_proxy,
std::span<std::byte> __storage) noexcept final override {
std::span<std::byte> __storage) noexcept final {
__schedule(__rcvr_proxy, STDEXEC::schedule(__sch_), __storage);
}

Expand All @@ -615,7 +615,7 @@ namespace STDEXEC {
void schedule_bulk_unchunked(
size_t __size,
system_context_replaceability::bulk_item_receiver_proxy& __rcvr_proxy,
std::span<std::byte> __storage) noexcept override {
std::span<std::byte> __storage) noexcept final {
auto __sndr = STDEXEC::bulk_unchunked(
STDEXEC::schedule(__sch_), par, __size, __detail::__bulk_unchunked_fn{__rcvr_proxy});
__schedule(__rcvr_proxy, std::move(__sndr), __storage);
Expand Down
1 change: 0 additions & 1 deletion include/stdexec/execution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "__detail/__operation_states.hpp"
#include "__detail/__read_env.hpp"
#include "__detail/__receiver_adaptor.hpp"
#include "__detail/__receiver_ref.hpp"
#include "__detail/__receivers.hpp"
#include "__detail/__run_loop.hpp"
#include "__detail/__schedule_from.hpp"
Expand Down
Loading