Skip to content

Commit b0708b5

Browse files
committed
[WIP] make senders conforming by giving them non-static connect and get_completion_signatures member fns
1 parent a9c12af commit b0708b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+700
-443
lines changed

.clang-format

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ LambdaBodyIndentation: Signature
8989
LineEnding: LF
9090
Macros: [
9191
'STDEXEC_CATCH_FALLTHROUGH= ',
92-
'STDEXEC_MEMFN_DECL(...)=__VA_ARGS__',
92+
'STDEXEC_EXPLICIT_THIS_BEGIN(...)=__VA_ARGS__',
93+
'STDEXEC_EXPLICIT_THIS_END(...)=',
9394
'STDEXEC_ATTRIBUTE(...)=__attribute__((__VA_ARGS__))',
9495
'STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS=[[no_unique_address]]',
9596
'STDEXEC_MISSING_MEMBER(X,Y)=true',

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ if(STDEXEC_ENABLE_TASKFLOW)
424424
CPM_ARGS
425425
GITHUB_REPOSITORY taskflow/taskflow
426426
GIT_TAG v3.7.0
427+
OPTIONS "TF_BUILD_TESTS OFF"
427428
)
428429
file(GLOB_RECURSE taskflow_pool include/execpools/taskflow/*.hpp)
429430
add_library(taskflow_pool INTERFACE ${taskflowexec_sources})

docs/Doxyfile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2371,7 +2371,8 @@ PREDEFINED = __cplusplus=202302L \
23712371
"STDEXEC_SYSTEM_CONTEXT_INLINE=inline" \
23722372
"STDEXEC_ATTRIBUTE(X)= " \
23732373
"STDEXEC_AUTO_RETURN(...)=->decltype(auto){ return __VA_ARGS__; }" \
2374-
"STDEXEC_MEMFN_DECL(...)=__VA_ARGS__" \
2374+
"STDEXEC_EXPLICIT_THIS_BEGIN(...)=__VA_ARGS__" \
2375+
"STDEXEC_EXPLICIT_THIS_END(...)= " \
23752376
"STDEXEC_CLANG()=1" \
23762377
"STDEXEC_MSVC()=0" \
23772378
"STDEXEC_GCC()=0" \

examples/algorithms/then.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
// Pull in the reference implementation of P2300:
2020
#include <stdexec/execution.hpp>
2121

22-
using namespace stdexec::tags;
23-
2422
///////////////////////////////////////////////////////////////////////////////
2523
// then algorithm:
2624
template <class R, class F>

examples/benchmark/static_thread_pool_old.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,11 @@ namespace exec_old {
499499
}
500500

501501
template <stdexec::__decays_to<bulk_sender> Self, class Env>
502-
static auto get_completion_signatures(Self&&, Env&&) -> completion_signatures<Self, Env> {
502+
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this Self&&, Env&&)
503+
-> completion_signatures<Self, Env> {
503504
return {};
504505
}
506+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
505507

506508
auto get_env() const noexcept -> stdexec::env_of_t<const Sender&> {
507509
return stdexec::get_env(sndr_);

examples/nvexec/maxwell/snr.cuh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,12 @@ namespace nvexec::_strm {
410410

411411
template <ex::__decays_to<sender_t> Self, ex::receiver Receiver>
412412
requires(ex::sender_to<Sender, Receiver>)
413-
static auto connect(Self&& self, Receiver r)
413+
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this Self&& self, Receiver r)
414414
-> nvexec::_strm::repeat_n::operation_state_t<SenderId, Closure, ex::__id<Receiver>> {
415415
return nvexec::_strm::repeat_n::operation_state_t<SenderId, Closure, ex::__id<Receiver>>(
416416
static_cast<Sender&&>(self.sender_), self.closure_, static_cast<Receiver&&>(r), self.n_);
417417
}
418+
STDEXEC_EXPLICIT_THIS_END(connect)
418419

419420
[[nodiscard]]
420421
auto get_env() const noexcept -> ex::env_of_t<const Sender&> {

include/exec/__detail/__basic_sequence.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ namespace exec {
6464
}
6565

6666
template <stdexec::__decays_to<__seqexpr> _Self, class... _Env>
67-
static auto get_completion_signatures(_Self&& __self, _Env&&... __env)
67+
STDEXEC_EXPLICIT_THIS_BEGIN(
68+
auto get_completion_signatures)(this _Self&& __self, _Env&&... __env)
6869
-> decltype(__self.__tag().get_completion_signatures(
6970
static_cast<_Self&&>(__self),
7071
static_cast<_Env&&>(__env)...)) {
7172
return {};
7273
}
74+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
7375

7476
template <stdexec::__decays_to<__seqexpr> _Self, class... _Env>
7577
static auto get_item_types(_Self&& __self, _Env&&... __env)

include/exec/any_sender_of.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,10 +1227,11 @@ namespace exec {
12271227

12281228
template <stdexec::__decays_to_derived_from<any_sender> _Self, class... _Env>
12291229
requires(__any::__satisfies_receiver_query<decltype(_ReceiverQueries), _Env...> && ...)
1230-
static auto get_completion_signatures(_Self&&, _Env&&...) noexcept
1230+
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...) noexcept
12311231
-> __sender_base::completion_signatures {
12321232
return {};
12331233
}
1234+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
12341235

12351236
template <stdexec::receiver_of<_Completions> _Receiver>
12361237
auto connect(_Receiver __rcvr) && -> stdexec::connect_result_t<__sender_base, _Receiver> {

include/exec/async_scope.hpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,19 @@ namespace exec {
117117
template <__decays_to<__t> _Self, receiver _Receiver>
118118
requires sender_to<__copy_cvref_t<_Self, _Constrained>, _Receiver>
119119
[[nodiscard]]
120-
static auto
121-
connect(_Self&& __self, _Receiver __rcvr) -> __when_empty_op_t<_Self, _Receiver> {
120+
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this _Self&& __self, _Receiver __rcvr)
121+
-> __when_empty_op_t<_Self, _Receiver> {
122122
return __when_empty_op_t<_Self, _Receiver>{
123123
__self.__scope_, static_cast<_Self&&>(__self).__c_, static_cast<_Receiver&&>(__rcvr)};
124124
}
125+
STDEXEC_EXPLICIT_THIS_END(connect)
125126

126127
template <__decays_to<__t> _Self, class... _Env>
127-
static auto get_completion_signatures(_Self&&, _Env&&...)
128+
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
128129
-> __completion_signatures_of_t<__copy_cvref_t<_Self, _Constrained>, __env_t<_Env>...> {
129130
return {};
130131
}
132+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
131133

132134
const __impl* __scope_;
133135
STDEXEC_ATTRIBUTE(no_unique_address) _Constrained __c_;
@@ -256,16 +258,19 @@ namespace exec {
256258
template <__decays_to<__t> _Self, receiver _Receiver>
257259
requires sender_to<__copy_cvref_t<_Self, _Constrained>, __nest_receiver_t<_Receiver>>
258260
[[nodiscard]]
259-
static auto connect(_Self&& __self, _Receiver __rcvr) -> __nest_operation_t<_Receiver> {
261+
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this _Self&& __self, _Receiver __rcvr)
262+
-> __nest_operation_t<_Receiver> {
260263
return __nest_operation_t<_Receiver>{
261264
__self.__scope_, static_cast<_Self&&>(__self).__c_, static_cast<_Receiver&&>(__rcvr)};
262265
}
266+
STDEXEC_EXPLICIT_THIS_END(connect)
263267

264268
template <__decays_to<__t> _Self, class... _Env>
265-
static auto get_completion_signatures(_Self&&, _Env&&...)
269+
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
266270
-> __completion_signatures_of_t<__copy_cvref_t<_Self, _Constrained>, __env_t<_Env>...> {
267271
return {};
268272
}
273+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
269274
};
270275
};
271276

@@ -654,15 +659,19 @@ namespace exec {
654659

655660
template <__decays_to<__t> _Self, receiver _Receiver>
656661
requires receiver_of<_Receiver, __completions_t<_Self>>
657-
static auto connect(_Self&& __self, _Receiver __rcvr) -> __future_op_t<_Receiver> {
662+
STDEXEC_EXPLICIT_THIS_BEGIN(auto connect)(this _Self&& __self, _Receiver __rcvr)
663+
-> __future_op_t<_Receiver> {
658664
return __future_op_t<_Receiver>{
659665
static_cast<_Receiver&&>(__rcvr), static_cast<_Self&&>(__self).__state_};
660666
}
667+
STDEXEC_EXPLICIT_THIS_END(connect)
661668

662669
template <__decays_to<__t> _Self, class... _OtherEnv>
663-
static auto get_completion_signatures(_Self&&, _OtherEnv&&...) -> __completions_t<_Self> {
670+
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _OtherEnv&&...)
671+
-> __completions_t<_Self> {
664672
return {};
665673
}
674+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
666675

667676
private:
668677
friend struct async_scope;

include/exec/at_coroutine_exit.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ namespace exec {
9292
}
9393

9494
template <__same_as<__t> _Self, class... _Env>
95-
static auto get_completion_signatures(_Self&&, _Env&&...) -> __completions_t<_Env...> {
95+
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
96+
-> __completions_t<_Env...> {
9697
return {};
9798
}
99+
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
98100

99101
auto get_env() const noexcept -> env_of_t<_Sender> {
100102
return stdexec::get_env(__sender_);

0 commit comments

Comments
 (0)