Skip to content

Commit 62c5dfe

Browse files
authored
Merge pull request #1776 from ericniebler/remove-any-receiver-ref
remove unused `__any_receiver_ref`
2 parents e8a6c64 + cc71913 commit 62c5dfe

6 files changed

Lines changed: 37 additions & 140 deletions

File tree

include/exec/any_sender_of.hpp

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
#pragma once
1717

18-
#include "../stdexec/__detail/__any_receiver_ref.hpp"
1918
#include "../stdexec/execution.hpp"
2019

2120
#include "sequence_senders.hpp"
@@ -27,6 +26,26 @@ namespace exec {
2726
namespace __any {
2827
using namespace STDEXEC;
2928

29+
template <class _Sig>
30+
struct __rcvr_vfun;
31+
32+
template <class _Tag, class... _Args>
33+
struct __rcvr_vfun<_Tag(_Args...)> {
34+
void (*__complete_)(void*, _Args...) noexcept;
35+
36+
void operator()(void* __obj, _Tag, _Args... __args) const noexcept {
37+
__complete_(__obj, static_cast<_Args&&>(__args)...);
38+
}
39+
};
40+
41+
template <class _GetReceiver = std::identity, class _Obj, class _Tag, class... _Args>
42+
constexpr auto __rcvr_vfun_fn(_Obj*, _Tag (*)(_Args...)) noexcept {
43+
return +[](void* __ptr, _Args... __args) noexcept {
44+
_Obj* __obj = static_cast<_Obj*>(__ptr);
45+
_Tag()(std::move(_GetReceiver()(*__obj)), static_cast<_Args&&>(__args)...);
46+
};
47+
}
48+
3049
struct __create_vtable_t {
3150
template <class _VTable, class _Tp>
3251
constexpr auto operator()(__mtype<_VTable>, __mtype<_Tp>) const noexcept -> const _VTable* {
@@ -656,19 +675,19 @@ namespace exec {
656675
template <class... _Sigs, class... _Queries>
657676
struct __vtable<completion_signatures<_Sigs...>, _Queries...> {
658677
struct __t
659-
: __overload<__any_::__rcvr_vfun<_Sigs>...>
678+
: __overload<__rcvr_vfun<_Sigs>...>
660679
, __query_vfun<_Queries>... {
661680
using __query_vfun<_Queries>::operator()...;
662681

663682
template <class _Tag, class... _As>
664683
requires __one_of<_Tag(_As...), _Sigs...>
665-
|| __callable<__overload<__any_::__rcvr_vfun<_Sigs>...>, void*, _Tag, _As...>
684+
|| __callable<__overload<__rcvr_vfun<_Sigs>...>, void*, _Tag, _As...>
666685
void operator()(void* __rcvr, _Tag, _As&&... __as) const noexcept {
667686
if constexpr (__one_of<_Tag(_As...), _Sigs...>) {
668-
const __any_::__rcvr_vfun<_Tag(_As...)>& __vfun = *this;
687+
const __rcvr_vfun<_Tag(_As...)>& __vfun = *this;
669688
__vfun(__rcvr, _Tag(), static_cast<_As&&>(__as)...);
670689
} else {
671-
const __overload<__any_::__rcvr_vfun<_Sigs>...>& __vfun = *this;
690+
const __overload<__rcvr_vfun<_Sigs>...>& __vfun = *this;
672691
__vfun(__rcvr, _Tag(), static_cast<_As&&>(__as)...);
673692
}
674693
}
@@ -678,7 +697,7 @@ namespace exec {
678697
&& (__callable<__query_vfun_fn<_Rcvr>, _Queries> && ...)
679698
static auto __create_vtable(__mtype<_Rcvr>) noexcept -> const __t* {
680699
static const __t __vtable_{
681-
{{__any_::__rcvr_vfun_fn(
700+
{{__rcvr_vfun_fn(
682701
static_cast<_Rcvr*>(nullptr), static_cast<_Sigs*>(nullptr))}...},
683702
{__query_vfun_fn<_Rcvr>{}(static_cast<_Queries>(nullptr))}...};
684703
return &__vtable_;
@@ -791,34 +810,34 @@ namespace exec {
791810

792811
template <class... _As>
793812
requires __one_of<set_value_t(_As...), _Sigs...>
794-
|| __callable<__overload<__any_::__rcvr_vfun<_Sigs>...>, void*, set_value_t, _As...>
813+
|| __callable<__overload<__rcvr_vfun<_Sigs>...>, void*, set_value_t, _As...>
795814
void set_value(_As&&... __as) noexcept {
796815
if constexpr (__one_of<set_value_t(_As...), _Sigs...>) {
797-
const __any_::__rcvr_vfun<set_value_t(_As...)>& __vfun = *__env_.__vtable_;
816+
const __rcvr_vfun<set_value_t(_As...)>& __vfun = *__env_.__vtable_;
798817
__vfun(__env_.__rcvr_, set_value_t(), static_cast<_As&&>(__as)...);
799818
} else {
800-
const __overload<__any_::__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
819+
const __overload<__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
801820
__vfun(__env_.__rcvr_, set_value_t(), static_cast<_As&&>(__as)...);
802821
}
803822
}
804823

805824
template <class _Error>
806825
requires __one_of<set_error_t(_Error), _Sigs...>
807-
|| __callable<__overload<__any_::__rcvr_vfun<_Sigs>...>, void*, set_error_t, _Error>
826+
|| __callable<__overload<__rcvr_vfun<_Sigs>...>, void*, set_error_t, _Error>
808827
void set_error(_Error&& __err) noexcept {
809828
if constexpr (__one_of<set_error_t(_Error), _Sigs...>) {
810-
const __any_::__rcvr_vfun<set_error_t(_Error)>& __vfun = *__env_.__vtable_;
829+
const __rcvr_vfun<set_error_t(_Error)>& __vfun = *__env_.__vtable_;
811830
__vfun(__env_.__rcvr_, set_error_t(), static_cast<_Error&&>(__err));
812831
} else {
813-
const __overload<__any_::__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
832+
const __overload<__rcvr_vfun<_Sigs>...>& __vfun = *__env_.__vtable_;
814833
__vfun(__env_.__rcvr_, set_error_t(), static_cast<_Error&&>(__err));
815834
}
816835
}
817836

818837
void set_stopped() noexcept
819838
requires __one_of<set_stopped_t(), _Sigs...>
820839
{
821-
const __any_::__rcvr_vfun<set_stopped_t()>& __vfun = *__env_.__vtable_;
840+
const __rcvr_vfun<set_stopped_t()>& __vfun = *__env_.__vtable_;
822841
__vfun(__env_.__rcvr_, set_stopped_t());
823842
}
824843

include/exec/sequence/any_sequence_of.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace exec {
6060

6161
struct __t
6262
: public __rcvr_next_vfun<_NextSigs>
63-
, public __any_::__rcvr_vfun<_Sigs>...
63+
, public __rcvr_vfun<_Sigs>...
6464
, public __query_vfun<_Queries>... {
6565
using __id = __next_vtable;
6666
using __query_vfun<_Queries>::operator()...;
@@ -71,7 +71,7 @@ namespace exec {
7171
static auto __create_vtable(__mtype<_Rcvr>) noexcept -> const __t* {
7272
static const __t __vtable_{
7373
{__rcvr_next_vfun_fn<_Rcvr>{}(static_cast<_NextSigs*>(nullptr))},
74-
{__any_::__rcvr_vfun_fn(
74+
{__rcvr_vfun_fn(
7575
static_cast<_Rcvr*>(nullptr), static_cast<_Sigs*>(nullptr))}...,
7676
{__query_vfun_fn<_Rcvr>{}(static_cast<_Queries>(nullptr))}...};
7777
return &__vtable_;
@@ -116,7 +116,7 @@ namespace exec {
116116
using __vtable_t = STDEXEC::__t<__next_vtable<__next_sigs, __sigs, _Queries...>>;
117117

118118
template <class Sig>
119-
using __vfun = __any_::__rcvr_vfun<Sig>;
119+
using __vfun = __rcvr_vfun<Sig>;
120120

121121
using __env_t = STDEXEC::__t<__env<__next_sigs, _Queries...>>;
122122
__env_t __env_;

include/stdexec/__detail/__any_receiver_ref.hpp

Lines changed: 0 additions & 120 deletions
This file was deleted.

include/stdexec/__detail/__let.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "__execution_fwd.hpp"
1919

2020
// include these after __execution_fwd.hpp
21-
#include "__any_receiver_ref.hpp" // IWYU pragma: keep for __any::__receiver_ref
2221
#include "__basic_sender.hpp"
2322
#include "__diagnostics.hpp"
2423
#include "__domain.hpp"

include/stdexec/__detail/__task_scheduler.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ namespace STDEXEC {
599599

600600
void schedule(
601601
system_context_replaceability::receiver_proxy& __rcvr_proxy,
602-
std::span<std::byte> __storage) noexcept final override {
602+
std::span<std::byte> __storage) noexcept final {
603603
__schedule(__rcvr_proxy, STDEXEC::schedule(__sch_), __storage);
604604
}
605605

@@ -615,7 +615,7 @@ namespace STDEXEC {
615615
void schedule_bulk_unchunked(
616616
size_t __size,
617617
system_context_replaceability::bulk_item_receiver_proxy& __rcvr_proxy,
618-
std::span<std::byte> __storage) noexcept override {
618+
std::span<std::byte> __storage) noexcept final {
619619
auto __sndr = STDEXEC::bulk_unchunked(
620620
STDEXEC::schedule(__sch_), par, __size, __detail::__bulk_unchunked_fn{__rcvr_proxy});
621621
__schedule(__rcvr_proxy, std::move(__sndr), __storage);

include/stdexec/execution.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "__detail/__operation_states.hpp"
4444
#include "__detail/__read_env.hpp"
4545
#include "__detail/__receiver_adaptor.hpp"
46-
#include "__detail/__receiver_ref.hpp"
4746
#include "__detail/__receivers.hpp"
4847
#include "__detail/__run_loop.hpp"
4948
#include "__detail/__schedule_from.hpp"

0 commit comments

Comments
 (0)