MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / __impls

Class __impls

include/exec/repeat_n.hpp:193–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 __opstate(std::size_t, _Child, _Receiver) -> __opstate<_Child, _Receiver>;
192
193 struct __impls : __sexpr_defaults
194 {
195 static constexpr auto __get_attrs =
196 []<class _Child>(__ignore, __ignore, _Child const &__child) noexcept
197 -> __seq::__attrs<schedule_result_t<trampoline_scheduler>, _Child &>
198 {
199 return {STDEXEC::schedule(trampoline_scheduler{}), const_cast<_Child &>(__child)};
200 };
201
202 template <class _Sender, class... _Env>
203 static consteval auto __get_completion_signatures()
204 {
205 using __child_t = __child_of<_Sender>;
206
207 auto __completions = transform_completion_signatures(
208 STDEXEC::get_completion_signatures<__bouncy_sndr_t<__child_t>, _Env...>(),
209 // transform for set_value completions:
210 []<class... _Args>()
211 {
212 if constexpr (sizeof...(_Args) == 0)
213 return completion_signatures<set_value_t()>();
214 else
215 return STDEXEC::__throw_compile_time_error<
216 _WHAT_(_INVALID_ARGUMENT_),
217 _WHERE_(_IN_ALGORITHM_, repeat_n_t),
218 _WHY_(_THE_INPUT_SENDER_MUST_HAVE_VOID_VALUE_COMPLETION_),
219 _WITH_PRETTY_SENDER_<__child_t &>>();
220 },
221 // transform for set_error completions:
222 decay_arguments<set_error_t, repeat_n_t>());
223
224 STDEXEC_IF_OK(__completions)
225 {
226 // Conditionally add set_error(std::exception_ptr) when appropriate
227 if constexpr (__completions.template __contains<set_error_t(std::exception_ptr)>())
228 return __completions; // NOLINT(bugprone-branch-clone)
229 else if constexpr (sizeof...(_Env) == 0)
230 return STDEXEC::__throw_dependent_sender_error<__child_t>();
231 else if constexpr ((__nothrow_connect<__child_t, __receiver_archetype<_Env>> || ...))
232 return __completions;
233 else
234 return concat_completion_signatures(__completions, __eptr_completion_t());
235 }
236 }
237
238 static constexpr auto __connect = //
239 []<class _Receiver, class _Sender>(_Sender &&__sndr, _Receiver &&__rcvr) noexcept(
240 noexcept(__opstate(0, STDEXEC::__get<2>(__declval<_Sender>()), __declval<_Receiver>())))
241 {
242 std::size_t const __count = STDEXEC::__get<1>(__sndr);
243 return __opstate(__count,
244 STDEXEC::__get<2>(static_cast<_Sender &&>(__sndr)),
245 static_cast<_Receiver &&>(__rcvr));
246 };
247 };
248 } // namespace __repeat_n
249
250 struct repeat_n_t

Callers

nothing calls this directly

Calls 2

scheduleFunction · 0.70
__opstateClass · 0.70

Tested by

no test coverage detected