stdexec: update to later commit
Later commits in stdexec have some compile issues. Update to the
latest one without compile issues, in order to see if a linker issue
reported by another developer is resolved.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I99bb6ee9c383c3cb66a35b23f02a6a0ced102b49
diff --git a/include/sdbusplus/async/stdexec/__detail/__basic_sender.hpp b/include/sdbusplus/async/stdexec/__detail/__basic_sender.hpp
index 5f02635..843c5e4 100644
--- a/include/sdbusplus/async/stdexec/__detail/__basic_sender.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__basic_sender.hpp
@@ -53,7 +53,7 @@
STDEXEC_ATTRIBUTE((always_inline))
_Data&& operator()(__ignore, _Data&& __data, _Rest&&...) const noexcept
{
- return (_Data&&)__data;
+ return static_cast<_Data&&>(__data);
}
};
@@ -75,6 +75,9 @@
using __tag = _Tag;
using __data = _Data;
using __children = __types<_Child...>;
+
+ template <class _Fn>
+ using __f = __minvoke<_Fn, _Tag, _Data, _Child...>;
};
template <class _Fn>
@@ -174,7 +177,7 @@
// alignas(_Parent) char __buf[sizeof(_Parent)];
// _Parent* __parent = (_Parent*) &__buf;
// const std::ptrdiff_t __offset = (char*) &(__parent->*__mbr_ptr) - __buf;
-// return (_Parent*) ((char*) __child - __offset);
+// return (_Parent*) (static_cast<char*>(__child) - __offset);
// }
inline constexpr auto __get_attrs = //
@@ -188,7 +191,6 @@
{
return empty_env();
}
- STDEXEC_UNREACHABLE();
};
inline constexpr auto __get_env = //
@@ -197,7 +199,7 @@
inline constexpr auto __get_state = //
[]<class _Sender>(_Sender&& __sndr, __ignore) noexcept -> decltype(auto) {
- return STDEXEC_CALL_EXPLICIT_THIS_MEMFN((_Sender&&)__sndr,
+ return STDEXEC_CALL_EXPLICIT_THIS_MEMFN(static_cast<_Sender&&>(__sndr),
apply)(__get_data());
};
@@ -206,8 +208,8 @@
_Sender&& __sndr, _Receiver __rcvr) -> __op_state<_Sender, _Receiver>
requires __connectable<_Sender, _Receiver>
{
- return __op_state<_Sender, _Receiver>{(_Sender&&)__sndr,
- (_Receiver&&)__rcvr};
+ return __op_state<_Sender, _Receiver>{static_cast<_Sender&&>(__sndr),
+ static_cast<_Receiver&&>(__rcvr)};
};
inline constexpr auto __start = //
@@ -223,10 +225,10 @@
_Args&&... __args) noexcept {
static_assert(__v<_Index> == 0,
"I don't know how to complete this operation.");
- _SetTag()(std::move(__rcvr), (_Args&&)__args...);
+ _SetTag()(std::move(__rcvr), static_cast<_Args&&>(__args)...);
};
-inline constexpr auto __get_completion_signagures = //
+inline constexpr auto __get_completion_signatures = //
[](__ignore, __ignore) noexcept { return void(); };
template <class _ReceiverId, class _Sexpr, class _Idx>
@@ -252,15 +254,16 @@
// using __parent_op_t = __op_state<_Sexpr, _Receiver>;
// std::ptrdiff_t __offset = __parent_op_t::template
// __get_child_op_offset<__v<_Idx>>();
- // __parent_op_t* __parent = (__parent_op_t*) ((char*) __child -
- // __offset); return __t{__parent};
+ // __parent_op_t* __parent = (__parent_op_t*)
+ // (static_cast<char*>(__child) - __offset); return __t{__parent};
// }
template <__completion_tag _Tag, class... _Args>
STDEXEC_ATTRIBUTE((always_inline))
friend void tag_invoke(_Tag, __t&& __self, _Args&&... __args) noexcept
{
- __self.__op_->__complete(_Idx(), _Tag(), (_Args&&)__args...);
+ __self.__op_->__complete(_Idx(), _Tag(),
+ static_cast<_Args&&>(__args)...);
}
template <same_as<get_env_t> _Tag, class _SexprTag = __tag_t>
@@ -289,11 +292,12 @@
STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS __state_t __state_;
__op_base(_Sexpr&& __sndr, _Receiver&& __rcvr) :
- __rcvr_((_Receiver&&)__rcvr),
- __state_(__sexpr_impl<__tag_t>::get_state((_Sexpr&&)__sndr, __rcvr_))
+ __rcvr_(static_cast<_Receiver&&>(__rcvr)),
+ __state_(__sexpr_impl<__tag_t>::get_state(static_cast<_Sexpr&&>(__sndr),
+ __rcvr_))
{}
- _Receiver& __rcvr() & noexcept
+ auto __rcvr() & noexcept -> _Receiver&
{
return __rcvr_;
}
@@ -309,8 +313,9 @@
// STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS __state_t __state_;
// __op_base(_Sexpr&& __sndr, _Receiver&& __rcvr)
-// : __state_(__sexpr_impl<__tag_t>::get_state((_Sexpr&&) __sndr, __rcvr)) {
-// STDEXEC_ASSERT(this->__rcvr().__op_ == __rcvr.__op_);
+// :
+// __state_(__sexpr_impl<__tag_t>::get_state(static_cast<_Sexpr&&>(__sndr),
+// __rcvr)) { STDEXEC_ASSERT(this->__rcvr().__op_ == __rcvr.__op_);
// }
// _Receiver __rcvr() const noexcept {
@@ -329,12 +334,13 @@
{
using __op_base_t = __op_base<_Sexpr, _Receiver>;
- decltype(auto) __receiver() noexcept
+ auto __receiver() noexcept -> decltype(auto)
{
using __derived_t = decltype(__op_base_t::__state_);
- __derived_t* __derived = static_cast<__derived_t*>(this);
+ auto* __derived = static_cast<__derived_t*>(this);
constexpr std::size_t __offset = offsetof(__op_base_t, __state_);
- __op_base_t* __base = (__op_base_t*)((char*)__derived - __offset);
+ auto* __base = reinterpret_cast<__op_base_t*>(
+ reinterpret_cast<char*>(__derived) - __offset);
return __base->__rcvr();
}
};
@@ -363,8 +369,8 @@
-> __tup::__tuple<__indices<_Is...>,
connect_result_t<_Child, __receiver_t<_Is>>...>
{
- return __tuple{
- connect((_Child&&)__child, __receiver_t<_Is>{__op_})...};
+ return __tuple{connect(static_cast<_Child&&>(__child),
+ __receiver_t<_Is>{__op_})...};
}
};
@@ -374,7 +380,8 @@
_Child...>
{
return __impl{__op_}(__indices_for<_Child...>(), _Tag(),
- (_Data&&)__data, (_Child&&)__child...);
+ static_cast<_Data&&>(__data),
+ static_cast<_Child&&>(__child)...);
}
};
STDEXEC_PRAGMA_POP()
@@ -396,12 +403,14 @@
// static std::ptrdiff_t __get_child_op_offset() noexcept {
// __op_state* __self = (__op_state*) &__self;
// return (std::ptrdiff_t)((char*)
- // &__tup::__get<_Idx>(__self->__inner_ops_) - (char*) __self);
+ // &__tup::__get<_Idx>(__self->__inner_ops_) -
+ // static_cast<char*>(__self));
// }
__op_state(_Sexpr&& __sexpr, _Receiver __rcvr) :
- __op_state::__op_base{(_Sexpr&&)__sexpr, (_Receiver&&)__rcvr},
- __inner_ops_(__sexpr_apply((_Sexpr&&)__sexpr,
+ __op_state::__op_base{static_cast<_Sexpr&&>(__sexpr),
+ static_cast<_Receiver&&>(__rcvr)},
+ __inner_ops_(__sexpr_apply(static_cast<_Sexpr&&>(__sexpr),
__connect_fn<_Sexpr, _Receiver>{this}))
{}
@@ -425,11 +434,12 @@
using __tag_t = typename __op_state::__tag_t;
auto&& __rcvr = this->__rcvr();
__sexpr_impl<__tag_t>::complete(_Index(), this->__state_, __rcvr,
- _Tag2(), (_Args&&)__args...);
+ _Tag2(),
+ static_cast<_Args&&>(__args)...);
}
template <class _Index>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
auto __get_env(_Index) noexcept
-> __env_type_t<__tag_t, _Index, _Sexpr, _Receiver>
{
@@ -445,9 +455,55 @@
auto&&, _Rest&&... __rest) noexcept(__nothrow_callable<const _Fn&,
_Rest...>)
-> __call_result_t<const _Fn&, _Rest...> {
- return __fn((_Rest&&)__rest...);
+ return __fn(static_cast<_Rest&&>(__rest)...);
};
};
+
+template <class _Tag, class... _Captures>
+STDEXEC_ATTRIBUTE((host, device, always_inline))
+constexpr auto __captures(_Tag, _Captures&&... __captures2)
+{
+ return
+ [... __captures3 = static_cast<_Captures&&>(
+ __captures2)]<class _Cvref, class _Fun>(_Cvref,
+ _Fun&& __fun) mutable //
+ noexcept(
+ __nothrow_callable<_Fun, _Tag, __minvoke<_Cvref, _Captures>...>) //
+ -> __call_result_t<_Fun, _Tag, __minvoke<_Cvref, _Captures>...>
+ requires __callable<_Fun, _Tag, __minvoke<_Cvref, _Captures>...>
+ {
+ // The use of decltype(__captures3) here instead of _Captures is a
+ // workaround for a codegen bug in nvc++.
+ return static_cast<_Fun&&>(__fun)(
+ _Tag(), const_cast<__minvoke<_Cvref, decltype(__captures3)>&&>(
+ __captures3)...);
+ };
+}
+
+template <class _Sender>
+concept __non_dependent_sender = //
+ requires { typename _Sender::completion_signatures; } ||
+ requires { requires _Sender::__is_non_dependent(); };
+
+template <class _Tag, class... _Child>
+concept __is_non_dependent_sexpr = //
+ !requires { typename __sexpr_impl<_Tag>::is_dependent; } &&
+ (__non_dependent_sender<_Child> && ...);
+
+template <class _Tag, class _Data, class... _Child>
+using __is_non_dependent_t = __mbool<__is_non_dependent_sexpr<_Tag, _Child...>>;
+
+template <class _Tag, class _Data, class... _Child>
+using __captures_t = decltype(__detail::__captures(_Tag(), __declval<_Data>(),
+ __declval<_Child>()...));
+
+template <class, class, class... _Child>
+using __tuple_size_t = char[sizeof...(_Child) + 2];
+
+template <std::size_t _Idx, class _Descriptor>
+concept __in_range =
+ (_Idx < sizeof(__minvoke<_Descriptor, __q<__tuple_size_t>>));
+
} // namespace __detail
struct __sexpr_defaults
@@ -458,11 +514,11 @@
static constexpr auto connect = __detail::__connect;
static constexpr auto start = __detail::__start;
static constexpr auto complete = __detail::__complete;
- static constexpr auto get_completion_signagures =
- __detail::__get_completion_signagures;
+ static constexpr auto get_completion_signatures =
+ __detail::__get_completion_signatures;
};
-template <class Tag>
+template <class _Tag>
struct __sexpr_impl : __sexpr_defaults
{};
@@ -473,42 +529,44 @@
__mtypeof<__sexpr_impl<_Tag>::get_attrs>>;
//////////////////////////////////////////////////////////////////////////////////////////////////
-// __sexpr
+// __basic_sender
template <class...>
-struct __sexpr
+struct __basic_sender
{
- using __id = __sexpr;
- using __t = __sexpr;
+ using __id = __basic_sender;
+ using __t = __basic_sender;
};
-template <class _ImplFn>
-struct __sexpr<_ImplFn>
+template <auto _DescriptorFn, class = __anon>
+struct __sexpr
{
using sender_concept = sender_t;
- using __t = __sexpr;
+
using __id = __sexpr;
- using __desc_t = __call_result_t<_ImplFn, __cp, __detail::__get_desc>;
+ using __t = __sexpr;
+ using __desc_t = decltype(_DescriptorFn());
using __tag_t = typename __desc_t::__tag;
- using __data_t = typename __desc_t::__data;
- using __children_t = typename __desc_t::__children;
- using __arity_t = __mapply<__msize, __children_t>;
+ using __captures_t = __minvoke<__desc_t, __q<__detail::__captures_t>>;
+
+ static constexpr auto __is_non_dependent() noexcept -> bool
+ {
+ return __v<__minvoke<__desc_t, __q<__detail::__is_non_dependent_t>>>;
+ }
+
+ mutable __captures_t __impl_;
+
+ template <class _Tag, class _Data, class... _Child>
+ STDEXEC_ATTRIBUTE((host, device, always_inline))
+ explicit __sexpr(_Tag, _Data&& __data, _Child&&... __child) :
+ __impl_(__detail::__captures(_Tag(), static_cast<_Data&&>(__data),
+ static_cast<_Child&&>(__child)...))
+ {}
template <class _Tag>
using __impl = __sexpr_impl<__meval<__msecond, _Tag, __tag_t>>;
- STDEXEC_ATTRIBUTE((always_inline)) //
- static __tag_t __tag() noexcept
- {
- return {};
- }
-
- mutable _ImplFn __impl_;
-
- STDEXEC_ATTRIBUTE((host, device, always_inline))
- explicit __sexpr(_ImplFn __impl) : __impl_((_ImplFn&&)__impl) {}
-
template <same_as<get_env_t> _Tag, same_as<__sexpr> _Self>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
friend auto tag_invoke(_Tag, const _Self& __self) noexcept //
-> __msecond<
__if_c<same_as<_Tag, get_env_t> && same_as<_Self, __sexpr>>, //
@@ -520,7 +578,7 @@
template <same_as<get_completion_signatures_t> _Tag,
__decays_to<__sexpr> _Self, class _Env>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
friend auto tag_invoke(_Tag, _Self&& __self, _Env&& __env) noexcept //
-> __msecond<
__if_c<same_as<_Tag, get_completion_signatures_t> &&
@@ -533,34 +591,37 @@
// BUGBUG fix receiver constraint here:
template <same_as<connect_t> _Tag, __decays_to<__sexpr> _Self,
/*receiver*/ class _Receiver>
- STDEXEC_ATTRIBUTE((always_inline)) //
- friend auto tag_invoke(_Tag, _Self&& __self, _Receiver&& __rcvr) //
- noexcept(noexcept(__impl<_Tag>::connect((_Self&&)__self,
- (_Receiver&&)__rcvr))) //
+ STDEXEC_ATTRIBUTE((always_inline))
+ friend auto tag_invoke(_Tag, _Self&& __self, _Receiver&& __rcvr) //
+ noexcept(noexcept(__impl<_Tag>::connect(
+ static_cast<_Self&&>(__self), static_cast<_Receiver&&>(__rcvr)))) //
-> __msecond<
__if_c<same_as<_Tag, connect_t> && __decays_to<_Self, __sexpr>>,
__result_of<__impl<_Tag>::connect, _Self, _Receiver>>
{
- return __impl<_Tag>::connect((_Self&&)__self, (_Receiver&&)__rcvr);
+ return __impl<_Tag>::connect(static_cast<_Self&&>(__self),
+ static_cast<_Receiver&&>(__rcvr));
}
template <class _Sender, class _ApplyFn>
- STDEXEC_ATTRIBUTE((always_inline)) //
- STDEXEC_DEFINE_EXPLICIT_THIS_MEMFN(auto apply)(this _Sender&& __sndr,
- _ApplyFn&& __fun) //
- noexcept(__nothrow_callable<__detail::__impl_of<_Sender>,
- __copy_cvref_fn<_Sender>, _ApplyFn>) //
+ STDEXEC_ATTRIBUTE((always_inline))
+ STDEXEC_DEFINE_EXPLICIT_THIS_MEMFN(auto apply)(
+ this _Sender&& __sndr,
+ _ApplyFn&&
+ __fun) noexcept(__nothrow_callable<__detail::__impl_of<_Sender>,
+ __copy_cvref_fn<_Sender>,
+ _ApplyFn>) //
-> __call_result_t<__detail::__impl_of<_Sender>,
__copy_cvref_fn<_Sender>, _ApplyFn>
- { //
- return ((_Sender&&)__sndr)
- .__impl_(__copy_cvref_fn<_Sender>(), (_ApplyFn&&)__fun); //
+ { //
+ return static_cast<_Sender&&>(__sndr).__impl_(
+ __copy_cvref_fn<_Sender>(), static_cast<_ApplyFn&&>(__fun)); //
}
template <std::size_t _Idx, __decays_to_derived_from<__sexpr> _Self>
STDEXEC_ATTRIBUTE((always_inline))
friend decltype(auto) get(_Self&& __self) noexcept
- requires(_Idx < (__v<__arity_t> + 2))
+ requires __detail::__in_range<_Idx, __desc_t>
{
if constexpr (_Idx == 0)
{
@@ -571,13 +632,36 @@
return __self.__impl_(__copy_cvref_fn<_Self>(),
__nth_pack_element<_Idx>);
}
- STDEXEC_UNREACHABLE();
}
};
-template <class _ImplFn>
+namespace
+{
+template <class _Descriptor, auto _DescriptorFn = [] { return _Descriptor(); }>
+inline constexpr auto __descriptor_fn_v = _DescriptorFn;
+
+template <class _Tag, class _Data, class... _Child>
+inline constexpr auto __descriptor_fn()
+{
+ return __descriptor_fn_v<__detail::__desc<_Tag, _Data, _Child...>>;
+}
+} // namespace
+
+#if STDEXEC_NVHPC()
+#define STDEXEC_SEXPR_DESCRIPTOR(_Tag, _Data, _Child) \
+ stdexec::__descriptor_fn<_Tag, _Data, _Child>()
+#else
+#define STDEXEC_SEXPR_DESCRIPTOR(_Tag, _Data, _Child) \
+ stdexec::__descriptor_fn_v<stdexec::__detail::__desc<_Tag, _Data, _Child>>
+#endif
+
+template <class _Tag, class _Data, class... _Child>
STDEXEC_ATTRIBUTE((host, device))
-__sexpr(_ImplFn) -> __sexpr<_ImplFn>;
+__sexpr(_Tag, _Data, _Child...)
+ -> __sexpr<STDEXEC_SEXPR_DESCRIPTOR(_Tag, _Data, _Child...)>;
+
+template <class _Tag, class _Data, class... _Child>
+using __sexpr_t = __sexpr<STDEXEC_SEXPR_DESCRIPTOR(_Tag, _Data, _Child...)>;
//////////////////////////////////////////////////////////////////////////////////////////////////
// __make_sexpr
@@ -587,129 +671,35 @@
struct __make_sexpr_t
{
template <class _Data = __, class... _Child>
- constexpr auto operator()(_Data __data = {}, _Child... __child) const;
-};
-
-#if STDEXEC_NVHPC() || (STDEXEC_GCC() && __GNUC__ < 13)
-// The NVIDIA HPC compiler and gcc prior to v13 struggle with capture
-// initializers for a parameter pack. As a workaround, we use a wrapper that
-// performs moves when non-const lvalues are copied. That constructor is
-// only used when capturing the variables, never when the resulting lambda
-// is copied or moved.
-
-// Move-by-copy
-template <class _Ty>
-struct __mbc
-{
- template <class _Cvref>
- using __f = __minvoke<_Cvref, _Ty>;
-
- _Ty __value;
-
- STDEXEC_ATTRIBUTE((always_inline))
- explicit __mbc(_Ty& __v) noexcept(
- std::is_nothrow_move_constructible_v<_Ty>) :
- __value((_Ty&&)__v)
- {}
-
- // This is a template so as to not be considered a copy/move constructor.
- // Therefore, it doesn't suppress the generation of the default copy/move
- // constructors.
- STDEXEC_ATTRIBUTE((always_inline))
- __mbc(same_as<__mbc> auto& __that) noexcept(
- std::is_nothrow_move_constructible_v<_Ty>) :
- __value(static_cast<_Ty&&>(__that.__value))
- {}
-};
-
-// Rather strange definition of the lambda return type below is to reap the
-// benefits of SFINAE without nvc++ encoding the whole return type into the
-// symbol name.
-template <class _Ty>
-extern _Ty (*__f)();
-
-// Anonymous namespace here is to avoid symbol name collisions with the
-// lambda functions returned by __make_tuple.
-namespace
-{
-constexpr auto __make_tuple = //
- []<class _Tag, class... _Captures>(_Tag, _Captures&&... __captures) {
- return
- [=]<class _Cvref, class _Fun>(_Cvref __cvref, _Fun&& __fun) mutable //
- noexcept(
- __nothrow_callable<_Fun, _Tag, __minvoke<_Captures, _Cvref>...>) //
- -> decltype(__f<__call_result_t<_Fun, _Tag,
- __minvoke<_Captures, _Cvref>...>>())
- requires __callable<_Fun, _Tag, __minvoke<_Captures, _Cvref>...>
+ constexpr auto operator()(_Data __data = {}, _Child... __child) const
{
- return ((_Fun&&)__fun)(
- _Tag(),
- const_cast<__minvoke<_Captures, _Cvref>&&>(__captures.__value)...);
- };
+ return __sexpr_t<_Tag, _Data, _Child...>{
+ _Tag(), static_cast<_Data&&>(__data),
+ static_cast<_Child&&>(__child)...};
+ }
};
-} // anonymous namespace
-
-template <class _Tag>
-template <class _Data, class... _Child>
-constexpr auto __make_sexpr_t<_Tag>::operator()(_Data __data,
- _Child... __child) const
-{
- return __sexpr{__make_tuple(_Tag(), __detail::__mbc(__data),
- __detail::__mbc(__child)...)};
-}
-#else
-// Anonymous namespace here is to avoid symbol name collisions with the
-// lambda functions returned by __make_tuple.
-namespace
-{
-constexpr auto __make_tuple = //
- []<class _Tag, class... _Captures>(_Tag, _Captures&&... __captures) {
- return
- [... __captures = (_Captures&&)__captures]<class _Cvref, class _Fun>(
- _Cvref, _Fun&& __fun) mutable //
- noexcept(
- __nothrow_callable<_Fun, _Tag, __minvoke<_Cvref, _Captures>...>) //
- -> __call_result_t<_Fun, _Tag, __minvoke<_Cvref, _Captures>...>
- requires __callable<_Fun, _Tag, __minvoke<_Cvref, _Captures>...>
- {
- return ((_Fun&&)__fun)(
- _Tag(), const_cast<__minvoke<_Cvref, _Captures>&&>(__captures)...);
- };
-};
-} // anonymous namespace
-
-template <class _Tag>
-template <class _Data, class... _Child>
-constexpr auto __make_sexpr_t<_Tag>::operator()(_Data __data,
- _Child... __child) const
-{
- return __sexpr{__make_tuple(_Tag(), (_Data&&)__data, (_Child&&)__child...)};
-};
-#endif
-
-template <class _Tag>
-inline constexpr __make_sexpr_t<_Tag> __make_sexpr{};
} // namespace __detail
-using __detail::__make_sexpr;
-
-template <class _Tag, class _Data, class... _Child>
-using __sexpr_t = __result_of<__make_sexpr<_Tag>, _Data, _Child...>;
+template <class _Tag>
+inline constexpr __detail::__make_sexpr_t<_Tag> __make_sexpr{};
namespace __detail
{
struct __sexpr_apply_t
{
template <class _Sender, class _ApplyFn>
- STDEXEC_ATTRIBUTE((always_inline)) //
- auto operator()(_Sender&& __sndr, _ApplyFn&& __fun) const //
+ STDEXEC_ATTRIBUTE((always_inline))
+ auto operator()(_Sender&& __sndr, _ApplyFn&& __fun) const
noexcept(noexcept(STDEXEC_CALL_EXPLICIT_THIS_MEMFN(
- ((_Sender&&)__sndr), apply)((_ApplyFn&&)__fun))) //
- -> decltype(STDEXEC_CALL_EXPLICIT_THIS_MEMFN(((_Sender&&)__sndr),
- apply)((_ApplyFn&&)__fun))
+ (static_cast<_Sender&&>(__sndr)),
+ apply)(static_cast<_ApplyFn&&>(__fun)))) //
+ -> decltype(STDEXEC_CALL_EXPLICIT_THIS_MEMFN(
+ (static_cast<_Sender&&>(__sndr)),
+ apply)(static_cast<_ApplyFn&&>(__fun)))
{
- return STDEXEC_CALL_EXPLICIT_THIS_MEMFN(((_Sender&&)__sndr),
- apply)((_ApplyFn&&)__fun); //
+ return STDEXEC_CALL_EXPLICIT_THIS_MEMFN(
+ (static_cast<_Sender&&>(__sndr)),
+ apply)(static_cast<_ApplyFn&&>(__fun)); //
}
};
} // namespace __detail
@@ -735,13 +725,11 @@
{
struct __basic_sender_name
{
- template <class _Sender>
- using __f = //
- __call_result_t<__sexpr_apply_result_t<_Sender, __basic_sender_name>>;
-
template <class _Tag, class _Data, class... _Child>
- auto operator()(_Tag, _Data&&, _Child&&...) const //
- -> __sexpr<_Tag, _Data, __name_of<_Child>...> (*)();
+ using __result = __basic_sender<_Tag, _Data, __name_of<_Child>...>;
+
+ template <class _Sender>
+ using __f = __minvoke<typename __decay_t<_Sender>::__desc_t, __q<__result>>;
};
struct __id_name
@@ -759,8 +747,8 @@
template <class _Sender>
extern __mcompose<__cpclr, __name_of_fn<_Sender>> __name_of_v<const _Sender&>;
-template <class _Impl>
-extern __basic_sender_name __name_of_v<__sexpr<_Impl>>;
+template <auto _Descriptor>
+extern __basic_sender_name __name_of_v<__sexpr<_Descriptor>>;
template <__has_id _Sender>
requires(!same_as<__id<_Sender>, _Sender>)
@@ -770,16 +758,20 @@
namespace std
{
-template <class _Impl>
-struct tuple_size<stdexec::__sexpr<_Impl>> :
- integral_constant<
- size_t, stdexec::__v<typename stdexec::__sexpr<_Impl>::__arity_t> + 2>
+template <auto _Descriptor>
+struct tuple_size<stdexec::__sexpr<_Descriptor>> :
+ integral_constant<size_t,
+ stdexec::__v<stdexec::__minvoke<
+ stdexec::__result_of<_Descriptor>, stdexec::__msize>>>
{};
-template <size_t _Idx, class _Impl>
-struct tuple_element<_Idx, stdexec::__sexpr<_Impl>>
+template <size_t _Idx, auto _Descriptor>
+struct tuple_element<_Idx, stdexec::__sexpr<_Descriptor>>
{
- using type = stdexec::__remove_rvalue_reference_t<stdexec::__call_result_t<
- _Impl, stdexec::__cp, stdexec::__nth_pack_element_t<_Idx>>>;
+ using type = //
+ stdexec::__remove_rvalue_reference_t< //
+ stdexec::__call_result_t< //
+ stdexec::__detail::__impl_of<stdexec::__sexpr<_Descriptor>>,
+ stdexec::__cp, stdexec::__nth_pack_element_t<_Idx>>>;
};
} // namespace std
diff --git a/include/sdbusplus/async/stdexec/__detail/__concepts.hpp b/include/sdbusplus/async/stdexec/__detail/__concepts.hpp
index dd6d029..a3187a7 100644
--- a/include/sdbusplus/async/stdexec/__detail/__concepts.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__concepts.hpp
@@ -23,16 +23,16 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
template <class _Fun, class... _As>
-concept __callable = //
- requires(_Fun&& __fun, _As&&... __as) { //
- ((_Fun&&)__fun)((_As&&)__as...); //
+concept __callable = //
+ requires(_Fun&& __fun, _As&&... __as) { //
+ static_cast<_Fun&&>(__fun)(static_cast<_As&&>(__as)...); //
};
template <class _Fun, class... _As>
concept __nothrow_callable = //
__callable<_Fun, _As...> && //
requires(_Fun&& __fun, _As&&... __as) {
{
- ((_Fun&&)__fun)((_As&&)__as...)
+ static_cast<_Fun&&>(__fun)(static_cast<_As&&>(__as)...)
} noexcept;
};
diff --git a/include/sdbusplus/async/stdexec/__detail/__config.hpp b/include/sdbusplus/async/stdexec/__detail/__config.hpp
index 537de40..68dfa93 100644
--- a/include/sdbusplus/async/stdexec/__detail/__config.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__config.hpp
@@ -38,8 +38,12 @@
#define STDEXEC_EAT(...)
#define STDEXEC_NOT(_XP) STDEXEC_CAT(STDEXEC_NOT_, _XP)
-#define STDEXEC_NOT_0 1
-#define STDEXEC_NOT_1 0
+
+enum
+{
+ STDEXEC_NOT_0 = 1,
+ STDEXEC_NOT_1 = 0
+};
#define STDEXEC_IIF_0(_YP, ...) __VA_ARGS__
#define STDEXEC_IIF_1(_YP, ...) _YP
diff --git a/include/sdbusplus/async/stdexec/__detail/__domain.hpp b/include/sdbusplus/async/stdexec/__detail/__domain.hpp
index 0dcc3a8..a82a1e6 100644
--- a/include/sdbusplus/async/stdexec/__detail/__domain.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__domain.hpp
@@ -46,8 +46,8 @@
{
template <class _Tag, class _Data, class... _Children>
requires __has_legacy_c11n<_Tag, _Data, _Children...>
- decltype(auto) operator()(_Tag, _Data&& __data,
- _Children&&... __children) const
+ auto operator()(_Tag, _Data&& __data, _Children&&... __children) const
+ -> decltype(auto)
{
return __legacy_c11n_fn<_Tag, _Data, _Children...>()(
static_cast<_Data&&>(__data),
@@ -58,7 +58,7 @@
template <class _DomainOrTag, class _Sender, class... _Env>
concept __has_transform_sender =
requires(_DomainOrTag __tag, _Sender&& __sender, const _Env&... __env) {
- __tag.transform_sender((_Sender&&)__sender, __env...);
+ __tag.transform_sender(static_cast<_Sender&&>(__sender), __env...);
};
template <class _Sender, class... _Env>
@@ -69,7 +69,8 @@
template <class _Type, class _Sender, class _Env>
concept __has_transform_env =
requires(_Type __obj, _Sender&& __sender, _Env&& __env) {
- __obj.transform_env((_Sender&&)__sender, (_Env&&)__env);
+ __obj.transform_env(static_cast<_Sender&&>(__sender),
+ static_cast<_Env&&>(__env));
};
template <class _Sender, class _Env>
@@ -78,9 +79,10 @@
&& __has_transform_env<tag_of_t<_Sender>, _Sender, _Env>;
template <class _DomainOrTag, class... _Args>
-concept __has_apply_sender = requires(_DomainOrTag __tag, _Args&&... __args) {
- __tag.apply_sender((_Args&&)__args...);
- };
+concept __has_apply_sender =
+ requires(_DomainOrTag __tag, _Args&&... __args) {
+ __tag.apply_sender(static_cast<_Args&&>(__args)...);
+ };
} // namespace __domain
struct default_domain
@@ -97,18 +99,18 @@
if constexpr (__callable<__sexpr_apply_t, _Sender,
__domain::__legacy_customization>)
{
- return stdexec::__sexpr_apply((_Sender&&)__sndr,
+ return stdexec::__sexpr_apply(static_cast<_Sender&&>(__sndr),
__domain::__legacy_customization());
}
else if constexpr (__domain::__has_default_transform_sender<_Sender>)
{
- return tag_of_t<_Sender>().transform_sender((_Sender&&)__sndr);
+ return tag_of_t<_Sender>().transform_sender(
+ static_cast<_Sender&&>(__sndr));
}
else
{
- return static_cast<_Sender>((_Sender&&)__sndr);
+ return static_cast<_Sender>(static_cast<_Sender&&>(__sndr));
}
- STDEXEC_UNREACHABLE();
}
// Called with an environment during lazy customization
@@ -118,14 +120,13 @@
{
if constexpr (__domain::__has_default_transform_sender<_Sender, _Env>)
{
- return tag_of_t<_Sender>().transform_sender((_Sender&&)__sndr,
- __env);
+ return tag_of_t<_Sender>().transform_sender(
+ static_cast<_Sender&&>(__sndr), __env);
}
else
{
- return static_cast<_Sender>((_Sender&&)__sndr);
+ return static_cast<_Sender>(static_cast<_Sender&&>(__sndr));
}
- STDEXEC_UNREACHABLE();
}
template <class _Tag, class _Sender, class... _Args>
@@ -144,22 +145,23 @@
}
else
{
- return _Tag().apply_sender((_Sender&&)__sndr, (_Args&&)__args...);
+ return _Tag().apply_sender(static_cast<_Sender&&>(__sndr),
+ static_cast<_Args&&>(__args)...);
}
- STDEXEC_UNREACHABLE();
}
template <class _Sender, class _Env>
- decltype(auto) transform_env(_Sender&& __sndr, _Env&& __env) const noexcept
+ auto transform_env(_Sender&& __sndr, _Env&& __env) const noexcept
+ -> decltype(auto)
{
if constexpr (__domain::__has_default_transform_env<_Sender, _Env>)
{
- return tag_of_t<_Sender>().transform_env((_Sender&&)__sndr,
- (_Env&&)__env);
+ return tag_of_t<_Sender>().transform_env(
+ static_cast<_Sender&&>(__sndr), static_cast<_Env&&>(__env));
}
else
{
- return static_cast<_Env>((_Env&&)__env);
+ return static_cast<_Env>(static_cast<_Env&&>(__env));
}
}
};
@@ -223,7 +225,6 @@
{
return __def;
}
- STDEXEC_UNREACHABLE();
}
} __get_early_domain{};
@@ -259,7 +260,6 @@
{
return default_domain();
}
- STDEXEC_UNREACHABLE();
}
// The transfer algorithm is the exception to the rule. It ignores the
@@ -283,16 +283,17 @@
{
struct __common_domain_fn
{
- static default_domain __common_domain() noexcept
+ static auto __common_domain() noexcept -> default_domain
{
return {};
}
template <class _Domain, class... _OtherDomains>
requires __all_of<_Domain, _OtherDomains...>
- static _Domain __common_domain(_Domain __domain, _OtherDomains...) noexcept
+ static auto __common_domain(_Domain __domain, _OtherDomains...) noexcept
+ -> _Domain
{
- return (_Domain&&)__domain;
+ return static_cast<_Domain&&>(__domain);
}
template <class... _Domains>
diff --git a/include/sdbusplus/async/stdexec/__detail/__env.hpp b/include/sdbusplus/async/stdexec/__detail/__env.hpp
index d9f34b8..178b913 100644
--- a/include/sdbusplus/async/stdexec/__detail/__env.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__env.hpp
@@ -50,11 +50,11 @@
struct forwarding_query_t
{
template <class _Query>
- constexpr bool operator()(_Query __query) const noexcept
+ constexpr auto operator()(_Query __query) const noexcept -> bool
{
if constexpr (tag_invocable<forwarding_query_t, _Query>)
{
- return tag_invoke(*this, (_Query&&)__query);
+ return tag_invoke(*this, static_cast<_Query&&>(__query));
}
else if constexpr (std::derived_from<_Query, forwarding_query_t>)
{
@@ -73,7 +73,7 @@
constexpr auto operator()(_Query, _Queryable&&, _Default&& __default) const
noexcept(__nothrow_constructible_from<_Default, _Default&&>) -> _Default
{
- return (_Default&&)__default;
+ return static_cast<_Default&&>(__default);
}
template <class _Query, class _Queryable, class _Default>
@@ -83,7 +83,8 @@
noexcept(__nothrow_callable<_Query, _Queryable>)
-> __call_result_t<_Query, _Queryable>
{
- return ((_Query&&)__query)((_Queryable&&)__queryable);
+ return static_cast<_Query&&>(__query)(
+ static_cast<_Queryable&&>(__queryable));
}
};
@@ -91,7 +92,7 @@
{
template <class _Tp>
requires tag_invocable<execute_may_block_caller_t, __cref_t<_Tp>>
- constexpr bool operator()(_Tp&& __t) const noexcept
+ constexpr auto operator()(_Tp&& __t) const noexcept -> bool
{
static_assert(
same_as<bool, tag_invoke_result_t<execute_may_block_caller_t,
@@ -101,7 +102,7 @@
return tag_invoke(execute_may_block_caller_t{}, std::as_const(__t));
}
- constexpr bool operator()(auto&&) const noexcept
+ constexpr auto operator()(auto&&) const noexcept -> bool
{
return true;
}
@@ -120,8 +121,8 @@
std::as_const(__t));
}
- constexpr stdexec::forward_progress_guarantee
- operator()(auto&&) const noexcept
+ constexpr auto operator()(auto&&) const noexcept
+ -> stdexec::forward_progress_guarantee
{
return stdexec::forward_progress_guarantee::weakly_parallel;
}
@@ -136,18 +137,18 @@
template <class _Tp>
requires tag_invocable<__has_algorithm_customizations_t, __cref_t<_Tp>>
- constexpr __result_t<_Tp> operator()(_Tp&&) const
- noexcept(noexcept(__result_t<_Tp>{}))
+ constexpr auto operator()(_Tp&&) const noexcept(noexcept(__result_t<_Tp>{}))
+ -> __result_t<_Tp>
{
using _Boolean = tag_invoke_result_t<__has_algorithm_customizations_t,
__cref_t<_Tp>>;
static_assert(_Boolean{}
? true
- : true); // must be contextually convertible to bool
+ : false); // must be contextually convertible to bool
return _Boolean{};
}
- constexpr std::false_type operator()(auto&&) const noexcept
+ constexpr auto operator()(auto&&) const noexcept -> std::false_type
{
return {};
}
@@ -159,8 +160,8 @@
struct get_scheduler_t : __query<get_scheduler_t>
{
- friend constexpr bool tag_invoke(forwarding_query_t,
- const get_scheduler_t&) noexcept
+ friend constexpr auto tag_invoke(forwarding_query_t,
+ const get_scheduler_t&) noexcept -> bool
{
return true;
}
@@ -170,13 +171,15 @@
auto operator()(const _Env& __env) const noexcept
-> tag_invoke_result_t<get_scheduler_t, const _Env&>;
+ template <class _Tag = get_scheduler_t>
auto operator()() const noexcept;
};
struct get_delegatee_scheduler_t : __query<get_delegatee_scheduler_t>
{
- friend constexpr bool tag_invoke(forwarding_query_t,
+ friend constexpr auto tag_invoke(forwarding_query_t,
const get_delegatee_scheduler_t&) noexcept
+ -> bool
{
return true;
}
@@ -186,13 +189,14 @@
auto operator()(const _Env& __t) const noexcept
-> tag_invoke_result_t<get_delegatee_scheduler_t, const _Env&>;
+ template <class _Tag = get_delegatee_scheduler_t>
auto operator()() const noexcept;
};
struct get_allocator_t : __query<get_allocator_t>
{
- friend constexpr bool tag_invoke(forwarding_query_t,
- const get_allocator_t&) noexcept
+ friend constexpr auto tag_invoke(forwarding_query_t,
+ const get_allocator_t&) noexcept -> bool
{
return true;
}
@@ -208,19 +212,20 @@
return tag_invoke(get_allocator_t{}, __env);
}
+ template <class _Tag = get_allocator_t>
auto operator()() const noexcept;
};
struct get_stop_token_t : __query<get_stop_token_t>
{
- friend constexpr bool tag_invoke(forwarding_query_t,
- const get_stop_token_t&) noexcept
+ friend constexpr auto tag_invoke(forwarding_query_t,
+ const get_stop_token_t&) noexcept -> bool
{
return true;
}
template <class _Env>
- never_stop_token operator()(const _Env&) const noexcept
+ auto operator()(const _Env&) const noexcept -> never_stop_token
{
return {};
}
@@ -236,6 +241,7 @@
return tag_invoke(get_stop_token_t{}, __env);
}
+ template <class _Tag = get_stop_token_t>
auto operator()() const noexcept;
};
@@ -247,9 +253,9 @@
template <__completion_tag _CPO>
struct get_completion_scheduler_t : __query<get_completion_scheduler_t<_CPO>>
{
- friend constexpr bool
+ friend constexpr auto
tag_invoke(forwarding_query_t,
- const get_completion_scheduler_t<_CPO>&) noexcept
+ const get_completion_scheduler_t<_CPO>&) noexcept -> bool
{
return true;
}
@@ -274,7 +280,8 @@
return tag_invoke(get_domain_t{}, __ty);
}
- friend constexpr bool tag_invoke(forwarding_query_t, get_domain_t) noexcept
+ friend constexpr auto tag_invoke(forwarding_query_t, get_domain_t) noexcept
+ -> bool
{
return true;
}
@@ -337,8 +344,7 @@
{
template <class _EnvProvider>
requires tag_invocable<get_env_t, const _EnvProvider&>
- STDEXEC_ATTRIBUTE((always_inline)) //
- constexpr auto
+ STDEXEC_ATTRIBUTE((always_inline)) constexpr auto
operator()(const _EnvProvider& __env_provider) const noexcept
-> tag_invoke_result_t<get_env_t, const _EnvProvider&>
{
@@ -349,7 +355,7 @@
}
template <class _EnvProvider>
- constexpr empty_env operator()(const _EnvProvider&) const noexcept
+ constexpr auto operator()(const _EnvProvider&) const noexcept -> empty_env
{
return {};
}
@@ -360,9 +366,9 @@
struct __promise
{
template <class _Ty>
- _Ty&& await_transform(_Ty&& __value) noexcept
+ auto await_transform(_Ty&& __value) noexcept -> _Ty&&
{
- return (_Ty&&)__value;
+ return static_cast<_Ty&&>(__value);
}
template <class _Ty>
@@ -371,7 +377,7 @@
noexcept(nothrow_tag_invocable<as_awaitable_t, _Ty, __promise&>)
-> tag_invoke_result_t<as_awaitable_t, _Ty, __promise&>
{
- return tag_invoke(as_awaitable, (_Ty&&)__value, *this);
+ return tag_invoke(as_awaitable, static_cast<_Ty&&>(__value), *this);
}
template <same_as<get_env_t> _Tag>
@@ -386,18 +392,19 @@
{
using __t = __with;
using __id = __with;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Value __value_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Value __value_;
__with() = default;
constexpr explicit __with(_Value __value) noexcept(
__nothrow_decay_copyable<_Value>) :
- __value_((_Value&&)__value)
+ __value_(static_cast<_Value&&>(__value))
{}
constexpr explicit __with(_Value __value, _Tag, _Tags...) noexcept(
__nothrow_decay_copyable<_Value>) :
- __value_((_Value&&)__value)
+ __value_(static_cast<_Value&&>(__value))
{}
template <__one_of<_Tag, _Tags...> _Key>
@@ -417,7 +424,8 @@
static_assert(__nothrow_move_constructible<_Env>);
using __t = __fwd;
using __id = __fwd;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Env __env_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Env __env_;
template <__forwarding_query _Tag>
requires tag_invocable<_Tag, const _Env&>
@@ -459,11 +467,11 @@
{
if constexpr (same_as<_Env, _Env&>)
{
- return __ref{(_Env&&)__env};
+ return __ref{static_cast<_Env&&>(__env)};
}
else
{
- return (_Env&&)__env;
+ return static_cast<_Env&&>(__env);
}
}
};
@@ -476,7 +484,7 @@
using __id = __without_;
constexpr explicit __without_(_Env&& __env, _Tag, _Tags...) noexcept :
- _Env((_Env&&)__env)
+ _Env(static_cast<_Env&&>(__env))
{}
template <__one_of<_Tag, _Tags...> _Key, class _Self>
@@ -487,17 +495,18 @@
struct __without_fn
{
template <class _Env, class _Tag, class... _Tags>
- constexpr decltype(auto) operator()(_Env&& __env, _Tag,
- _Tags...) const noexcept
+ constexpr auto operator()(_Env&& __env, _Tag, _Tags...) const noexcept
+ -> decltype(auto)
{
if constexpr (tag_invocable<_Tag, _Env> ||
(tag_invocable<_Tags, _Env> || ...))
{
- return __without_{__ref_fn()((_Env&&)__env), _Tag(), _Tags()...};
+ return __without_{__ref_fn()(static_cast<_Env&&>(__env)), _Tag(),
+ _Tags()...};
}
else
{
- return static_cast<_Env>((_Env&&)__env);
+ return static_cast<_Env>(static_cast<_Env&&>(__env));
}
}
};
@@ -515,7 +524,8 @@
using __t = __joined;
using __id = __joined;
- STDEXEC_ATTRIBUTE((no_unique_address)) _First __env_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _First __env_;
template <class _Tag>
requires tag_invocable<_Tag, const _First&>
@@ -535,7 +545,8 @@
{
using __t = __from;
using __id = __from;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fun __fun_;
template <class _Tag>
requires __callable<const _Fun&, _Tag>
@@ -555,10 +566,10 @@
template <class Env>
auto operator()(Env&& env) const
{
- return __fwd{(Env&&)env};
+ return __fwd{static_cast<Env&&>(env)};
}
- empty_env operator()(empty_env) const
+ auto operator()(empty_env) const -> empty_env
{
return {};
}
@@ -566,44 +577,44 @@
struct __join_fn
{
- empty_env operator()() const
+ auto operator()() const -> empty_env
{
return {};
}
template <class _Env>
- _Env operator()(_Env&& __env) const
+ auto operator()(_Env&& __env) const -> _Env
{
- return (_Env&&)__env;
+ return static_cast<_Env&&>(__env);
}
- empty_env operator()(empty_env) const
+ auto operator()(empty_env) const -> empty_env
{
return {};
}
template <class _Env>
- _Env operator()(_Env&& __env, empty_env) const
+ auto operator()(_Env&& __env, empty_env) const -> _Env
{
- return (_Env&&)__env;
+ return static_cast<_Env&&>(__env);
}
- empty_env operator()(empty_env, empty_env) const
+ auto operator()(empty_env, empty_env) const -> empty_env
{
return {};
}
template <class... Rest>
- decltype(auto) operator()(empty_env, Rest&&... rest) const
+ auto operator()(empty_env, Rest&&... rest) const -> decltype(auto)
{
- return __fwd_fn()(__join_fn()((Rest&&)rest...));
+ return __fwd_fn()(__join_fn()(static_cast<Rest&&>(rest)...));
}
template <class First, class... Rest>
- decltype(auto) operator()(First&& first, Rest&&... rest) const
+ auto operator()(First&& first, Rest&&... rest) const -> decltype(auto)
{
- return __joined{__fwd_fn()(__join_fn()((Rest&&)rest...)),
- (First&&)first};
+ return __joined{__fwd_fn()(__join_fn()(static_cast<Rest&&>(rest)...)),
+ static_cast<First&&>(first)};
}
};
diff --git a/include/sdbusplus/async/stdexec/__detail/__execution_fwd.hpp b/include/sdbusplus/async/stdexec/__detail/__execution_fwd.hpp
index 760ae84..43e123a 100644
--- a/include/sdbusplus/async/stdexec/__detail/__execution_fwd.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__execution_fwd.hpp
@@ -128,7 +128,7 @@
namespace __get_completion_signatures
{
struct get_completion_signatures_t;
-}
+} // namespace __get_completion_signatures
using __get_completion_signatures::get_completion_signatures_t;
extern const get_completion_signatures_t get_completion_signatures;
@@ -137,7 +137,7 @@
namespace __connect
{
struct connect_t;
-}
+} // namespace __connect
using __connect::connect_t;
extern const connect_t connect;
@@ -158,7 +158,7 @@
namespace __start
{
struct start_t;
-}
+} // namespace __start
using __start::start_t;
extern const start_t start;
@@ -167,7 +167,7 @@
namespace __schedule
{
struct schedule_t;
-}
+} // namespace __schedule
using __schedule::schedule_t;
extern const schedule_t schedule;
@@ -176,7 +176,7 @@
namespace __as_awaitable
{
struct as_awaitable_t;
-}
+} // namespace __as_awaitable
using __as_awaitable::as_awaitable_t;
extern const as_awaitable_t as_awaitable;
@@ -185,7 +185,7 @@
namespace __transfer
{
struct transfer_t;
-}
+} // namespace __transfer
using __transfer::transfer_t;
extern const transfer_t transfer;
@@ -194,7 +194,7 @@
namespace __transfer_just
{
struct transfer_just_t;
-}
+} // namespace __transfer_just
using __transfer_just::transfer_just_t;
extern const transfer_just_t transfer_just;
@@ -203,7 +203,7 @@
namespace __bulk
{
struct bulk_t;
-}
+} // namespace __bulk
using __bulk::bulk_t;
extern const bulk_t bulk;
@@ -232,17 +232,17 @@
namespace __on_v2
{
struct on_t;
-}
+} // namespace __on_v2
namespace v2
{
using __on_v2::on_t;
-}
+} // namespace v2
namespace __detail
{
struct __sexpr_apply_t;
-}
+} // namespace __detail
using __detail::__sexpr_apply_t;
extern const __sexpr_apply_t __sexpr_apply;
diff --git a/include/sdbusplus/async/stdexec/__detail/__intrusive_ptr.hpp b/include/sdbusplus/async/stdexec/__detail/__intrusive_ptr.hpp
index efb1399..9897a0b 100644
--- a/include/sdbusplus/async/stdexec/__detail/__intrusive_ptr.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__intrusive_ptr.hpp
@@ -42,8 +42,8 @@
template <class _Ty>
struct __enable_intrusive_from_this
{
- __intrusive_ptr<_Ty> __intrusive_from_this() noexcept;
- __intrusive_ptr<const _Ty> __intrusive_from_this() const noexcept;
+ auto __intrusive_from_this() noexcept -> __intrusive_ptr<_Ty>;
+ auto __intrusive_from_this() const noexcept -> __intrusive_ptr<const _Ty>;
private:
friend _Ty;
@@ -68,7 +68,7 @@
// Construct the value *after* the initialization of the
// atomic in case the constructor of _Ty calls
// __intrusive_from_this() (which increments the atomic):
- ::new ((void*)__value_) _Ty{(_Us&&)__us...};
+ ::new (static_cast<void*>(__value_)) _Ty{static_cast<_Us&&>(__us)...};
}
~__control_block()
@@ -76,9 +76,9 @@
__value().~_Ty();
}
- _Ty& __value() const noexcept
+ auto __value() noexcept -> _Ty&
{
- return *(_Ty*)__value_;
+ return *reinterpret_cast<_Ty*>(__value_);
}
void __inc_ref_() noexcept
@@ -150,20 +150,20 @@
: __intrusive_ptr())
{}
- __intrusive_ptr& operator=(__intrusive_ptr&& __that) noexcept
+ auto operator=(__intrusive_ptr&& __that) noexcept -> __intrusive_ptr&
{
[[maybe_unused]] __intrusive_ptr __old{
std::exchange(__data_, std::exchange(__that.__data_, nullptr))};
return *this;
}
- __intrusive_ptr& operator=(const __intrusive_ptr& __that) noexcept
+ auto operator=(const __intrusive_ptr& __that) noexcept -> __intrusive_ptr&
{
return operator=(__intrusive_ptr(__that));
}
- __intrusive_ptr&
- operator=(__enable_intrusive_from_this<_Ty>* __that) noexcept
+ auto operator=(__enable_intrusive_from_this<_Ty>* __that) noexcept
+ -> __intrusive_ptr&
{
return operator=(__that ? __that->__intrusive_from_this()
: __intrusive_ptr());
@@ -184,17 +184,17 @@
std::swap(__data_, __that.__data_);
}
- _Ty* get() const noexcept
+ auto get() const noexcept -> _Ty*
{
return &__data_->__value();
}
- _Ty* operator->() const noexcept
+ auto operator->() const noexcept -> _Ty*
{
return &__data_->__value();
}
- _Ty& operator*() const noexcept
+ auto operator*() const noexcept -> _Ty&
{
return __data_->__value();
}
@@ -204,33 +204,35 @@
return __data_ != nullptr;
}
- bool operator!() const noexcept
+ auto operator!() const noexcept -> bool
{
return __data_ == nullptr;
}
- bool operator==(const __intrusive_ptr&) const = default;
+ auto operator==(const __intrusive_ptr&) const -> bool = default;
- bool operator==(std::nullptr_t) const noexcept
+ auto operator==(std::nullptr_t) const noexcept -> bool
{
return __data_ == nullptr;
}
};
template <class _Ty>
-__intrusive_ptr<_Ty>
- __enable_intrusive_from_this<_Ty>::__intrusive_from_this() noexcept
+auto __enable_intrusive_from_this<_Ty>::__intrusive_from_this() noexcept
+ -> __intrusive_ptr<_Ty>
{
- auto* __data = (__control_block<_Ty>*)static_cast<_Ty*>(this);
+ auto* __data =
+ reinterpret_cast<__control_block<_Ty>*>(static_cast<_Ty*>(this));
__data->__inc_ref_();
return __intrusive_ptr<_Ty>{__data};
}
template <class _Ty>
-__intrusive_ptr<const _Ty>
- __enable_intrusive_from_this<_Ty>::__intrusive_from_this() const noexcept
+auto __enable_intrusive_from_this<_Ty>::__intrusive_from_this() const noexcept
+ -> __intrusive_ptr<const _Ty>
{
- auto* __data = (__control_block<_Ty>*)static_cast<const _Ty*>(this);
+ auto* __data =
+ reinterpret_cast<__control_block<_Ty>*>(static_cast<const _Ty*>(this));
__data->__inc_ref_();
return __intrusive_ptr<const _Ty>{__data};
}
@@ -238,14 +240,16 @@
template <class _Ty>
void __enable_intrusive_from_this<_Ty>::__inc_ref() noexcept
{
- auto* __data = (__control_block<_Ty>*)static_cast<_Ty*>(this);
+ auto* __data =
+ reinterpret_cast<__control_block<_Ty>*>(static_cast<_Ty*>(this));
__data->__inc_ref_();
}
template <class _Ty>
void __enable_intrusive_from_this<_Ty>::__dec_ref() noexcept
{
- auto* __data = (__control_block<_Ty>*)static_cast<_Ty*>(this);
+ auto* __data =
+ reinterpret_cast<__control_block<_Ty>*>(static_cast<_Ty*>(this));
__data->__dec_ref_();
}
@@ -254,11 +258,11 @@
{
template <class... _Us>
requires constructible_from<_Ty, _Us...>
- __intrusive_ptr<_Ty> operator()(_Us&&... __us) const
+ auto operator()(_Us&&... __us) const -> __intrusive_ptr<_Ty>
{
using _UncvTy = std::remove_cv_t<_Ty>;
return __intrusive_ptr<_Ty>{
- ::new __control_block<_UncvTy>{(_Us&&)__us...}};
+ ::new __control_block<_UncvTy>{static_cast<_Us&&>(__us)...}};
}
};
} // namespace __ptr
diff --git a/include/sdbusplus/async/stdexec/__detail/__intrusive_queue.hpp b/include/sdbusplus/async/stdexec/__detail/__intrusive_queue.hpp
index ee577de..dbcccf4 100644
--- a/include/sdbusplus/async/stdexec/__detail/__intrusive_queue.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__intrusive_queue.hpp
@@ -44,7 +44,7 @@
__head_(__head), __tail_(__tail)
{}
- __intrusive_queue& operator=(__intrusive_queue __other) noexcept
+ auto operator=(__intrusive_queue __other) noexcept -> __intrusive_queue&
{
std::swap(__head_, __other.__head_);
std::swap(__tail_, __other.__tail_);
@@ -56,7 +56,7 @@
STDEXEC_ASSERT(empty());
}
- static __intrusive_queue make_reversed(_Item* __list) noexcept
+ static auto make_reversed(_Item* __list) noexcept -> __intrusive_queue
{
_Item* __new_head = nullptr;
_Item* __new_tail = __list;
@@ -74,7 +74,7 @@
return __result;
}
- static __intrusive_queue make(_Item* __list) noexcept
+ static auto make(_Item* __list) noexcept -> __intrusive_queue
{
__intrusive_queue __result{};
__result.__head_ = __list;
@@ -90,7 +90,7 @@
return __result;
}
- [[nodiscard]] bool empty() const noexcept
+ [[nodiscard]] auto empty() const noexcept -> bool
{
return __head_ == nullptr;
}
@@ -101,7 +101,7 @@
__tail_ = nullptr;
}
- [[nodiscard]] _Item* pop_front() noexcept
+ [[nodiscard]] auto pop_front() noexcept -> _Item*
{
STDEXEC_ASSERT(!empty());
_Item* __item = std::exchange(__head_, __head_->*_Next);
@@ -187,19 +187,19 @@
__predecessor_(__pred), __item_(__item)
{}
- [[nodiscard]] _Item* operator*() const noexcept
+ [[nodiscard]] auto operator*() const noexcept -> _Item*
{
STDEXEC_ASSERT(__item_ != nullptr);
return __item_;
}
- [[nodiscard]] _Item** operator->() const noexcept
+ [[nodiscard]] auto operator->() const noexcept -> _Item**
{
STDEXEC_ASSERT(__item_ != nullptr);
return &__item_;
}
- iterator& operator++() noexcept
+ auto operator++() noexcept -> iterator&
{
__predecessor_ = __item_;
if (__item_)
@@ -209,23 +209,23 @@
return *this;
}
- iterator operator++(int) noexcept
+ auto operator++(int) noexcept -> iterator
{
iterator __result = *this;
++*this;
return __result;
}
- friend bool operator==(const iterator&,
- const iterator&) noexcept = default;
+ friend auto operator==(const iterator&, const iterator&) noexcept
+ -> bool = default;
};
- [[nodiscard]] iterator begin() const noexcept
+ [[nodiscard]] auto begin() const noexcept -> iterator
{
return iterator(nullptr, __head_);
}
- [[nodiscard]] iterator end() const noexcept
+ [[nodiscard]] auto end() const noexcept -> iterator
{
return iterator(__tail_, nullptr);
}
@@ -268,12 +268,12 @@
}
}
- _Item* front() const noexcept
+ auto front() const noexcept -> _Item*
{
return __head_;
}
- _Item* back() const noexcept
+ auto back() const noexcept -> _Item*
{
return __tail_;
}
diff --git a/include/sdbusplus/async/stdexec/__detail/__meta.hpp b/include/sdbusplus/async/stdexec/__detail/__meta.hpp
index b350b99..a926d68 100644
--- a/include/sdbusplus/async/stdexec/__detail/__meta.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__meta.hpp
@@ -38,13 +38,19 @@
{
__ignore() = default;
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr __ignore(auto&&...) noexcept {}
};
struct __none_such
{};
+namespace
+{
+struct __anon
+{};
+} // namespace
+
struct __immovable
{
__immovable() = default;
@@ -58,10 +64,10 @@
__move_only() = default;
__move_only(__move_only&&) noexcept = default;
- __move_only& operator=(__move_only&&) noexcept = default;
+ auto operator=(__move_only&&) noexcept -> __move_only& = default;
__move_only(const __move_only&) = delete;
- __move_only& operator=(const __move_only&) = delete;
+ auto operator=(const __move_only&) -> __move_only& = delete;
};
template <class _Tp>
@@ -152,18 +158,19 @@
constexpr __mstring(_Char... __chars) noexcept : __what_{__chars...}
{}
- static constexpr std::size_t __length() noexcept
+ static constexpr auto __length() noexcept -> std::size_t
{
return _Len;
}
template <std::size_t... _Is>
- constexpr bool __equal(__mstring __other, __indices<_Is...>) const noexcept
+ constexpr auto __equal(__mstring __other, __indices<_Is...>) const noexcept
+ -> bool
{
return ((__what_[_Is] == __other.__what_[_Is]) && ...);
}
- constexpr bool operator==(__mstring __other) const noexcept
+ constexpr auto operator==(__mstring __other) const noexcept -> bool
{
return __equal(__other, __make_indices<_Len>());
}
@@ -210,15 +217,15 @@
#else
// Use a standard user-defined string literal template
template <__mstring _Str>
-[[deprecated("Use _mstr instead")]] constexpr __mtypeof<_Str>
- operator""__csz() noexcept
+[[deprecated("Use _mstr instead")]] constexpr auto operator""__csz() noexcept
+ -> __mtypeof<_Str>
{
return _Str;
}
// Use a standard user-defined string literal template
template <__mstring _Str>
-constexpr __mtypeof<_Str> operator""_mstr() noexcept
+constexpr auto operator""_mstr() noexcept -> __mtypeof<_Str>
{
return _Str;
}
@@ -235,7 +242,7 @@
template <class _What, class... _With>
struct _ERROR_
{
- _ERROR_ operator,(__msuccess) const noexcept;
+ auto operator,(__msuccess) const noexcept -> _ERROR_;
};
template <__mstring _What>
@@ -852,12 +859,12 @@
operator __t() && noexcept(__nothrow_callable<_Fn>)
{
- return ((_Fn&&)__fn_)();
+ return static_cast<_Fn&&>(__fn_)();
}
- __t operator()() && noexcept(__nothrow_callable<_Fn>)
+ auto operator()() && noexcept(__nothrow_callable<_Fn>) -> __t
{
- return ((_Fn&&)__fn_)();
+ return static_cast<_Fn&&>(__fn_)();
}
};
template <class _Fn>
@@ -868,7 +875,7 @@
struct __cref_fn
{
template <class _Ty>
- const _Ty& operator()(const _Ty&);
+ auto operator()(const _Ty&) -> const _Ty&;
};
template <class _Ty>
using __cref_t = decltype(__cref_fn{}(__declval<_Ty>()));
@@ -908,11 +915,11 @@
decltype(stdexec::__mconvert_indices<std::make_index_sequence<_Np>>);
#else
template <std::size_t... _Indices>
-__types<__msize_t<_Indices>...>
- __mconvert_indices(std::index_sequence<_Indices...>*);
+auto __mconvert_indices(std::index_sequence<_Indices...>*)
+ -> __types<__msize_t<_Indices>...>;
template <std::size_t _Np>
using __mmake_index_sequence = decltype(stdexec::__mconvert_indices(
- (std::make_index_sequence<_Np>*)nullptr));
+ static_cast<std::make_index_sequence<_Np>*>(nullptr)));
#endif
template <class... _Ts>
@@ -1052,8 +1059,8 @@
constexpr __placeholder(void*) noexcept {}
- friend constexpr std::size_t
- __get_placeholder_offset(__placeholder) noexcept
+ friend constexpr auto __get_placeholder_offset(__placeholder) noexcept
+ -> std::size_t
{
return _Np;
}
@@ -1084,10 +1091,10 @@
struct __nth_pack_element_impl
{
template <class _Ty, class... _Us>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr _Ty&& operator()(_Ignore..., _Ty&& __t, _Us&&...) const noexcept
{
- return (decltype(__t)&&)__t;
+ return static_cast<decltype(__t)&&>(__t);
}
};
@@ -1095,18 +1102,18 @@
struct __nth_pack_element_t
{
template <std::size_t... _Is>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
static constexpr auto __impl(__indices<_Is...>) noexcept
{
return __nth_pack_element_impl<__ignore_t<_Is>...>();
}
template <class... _Ts>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr decltype(auto) operator()(_Ts&&... __ts) const noexcept
{
static_assert(_Np < sizeof...(_Ts));
- return __impl(__make_indices<_Np>())((_Ts&&)__ts...);
+ return __impl(__make_indices<_Np>())(static_cast<_Ts&&>(__ts)...);
}
};
@@ -1117,7 +1124,7 @@
struct __mliterals
{
template <std::size_t _Np>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
static constexpr auto __nth() noexcept
{
return stdexec::__nth_pack_element<_Np>(_Vs...);
@@ -1128,10 +1135,10 @@
struct __nth_member
{
template <class _Ty>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr decltype(auto) operator()(_Ty&& __ty) const noexcept
{
- return ((_Ty&&)__ty).*(__ty.__mbrs_.template __nth<_Np>());
+ return static_cast<_Ty&&>(__ty).*(__ty.__mbrs_.template __nth<_Np>());
}
};
@@ -1139,7 +1146,7 @@
struct __mdispatch_
{
template <class... _Ts>
- _Ty operator()(_Ts&&...) const noexcept(noexcept(_Ty{}))
+ auto operator()(_Ts&&...) const noexcept(noexcept(_Ty{})) -> _Ty
{
return _Ty{};
}
@@ -1149,9 +1156,10 @@
struct __mdispatch_<__placeholder<_Np>, _Offset>
{
template <class... _Ts>
- decltype(auto) operator()(_Ts&&... __ts) const noexcept
+ auto operator()(_Ts&&... __ts) const noexcept -> decltype(auto)
{
- return stdexec::__nth_pack_element<_Np + _Offset>((_Ts&&)__ts...);
+ return stdexec::__nth_pack_element<_Np + _Offset>(
+ static_cast<_Ts&&>(__ts)...);
}
};
@@ -1159,7 +1167,7 @@
struct __mdispatch_<__placeholder<_Np>&, _Offset>
{
template <class... _Ts>
- decltype(auto) operator()(_Ts&&... __ts) const noexcept
+ auto operator()(_Ts&&... __ts) const noexcept -> decltype(auto)
{
return stdexec::__nth_pack_element<_Np + _Offset>(__ts...);
}
@@ -1169,7 +1177,7 @@
struct __mdispatch_<__placeholder<_Np>&&, _Offset>
{
template <class... _Ts>
- decltype(auto) operator()(_Ts&&... __ts) const noexcept
+ auto operator()(_Ts&&... __ts) const noexcept -> decltype(auto)
{
return std::move(stdexec::__nth_pack_element<_Np + _Offset>(__ts...));
}
@@ -1179,7 +1187,7 @@
struct __mdispatch_<const __placeholder<_Np>&, _Offset>
{
template <class... _Ts>
- decltype(auto) operator()(_Ts&&... __ts) const noexcept
+ auto operator()(_Ts&&... __ts) const noexcept -> decltype(auto)
{
return std::as_const(
stdexec::__nth_pack_element<_Np + _Offset>(__ts...));
@@ -1199,7 +1207,8 @@
-> __call_result_t<
_Ret, __call_result_t<__mdispatch_<_Args, _Offset>, _Ts...>...>
{
- return _Ret{}(__mdispatch_<_Args, _Offset>{}((_Ts&&)__ts...)...);
+ return _Ret{}(
+ __mdispatch_<_Args, _Offset>{}(static_cast<_Ts&&>(__ts)...)...);
}
};
@@ -1209,7 +1218,7 @@
static_assert(_Offset == 0, "nested pack expressions are not supported");
using _Pattern = __mback<_Args...>;
static constexpr std::size_t __offset =
- __get_placeholder_offset((__mtype<_Pattern>*)nullptr);
+ __get_placeholder_offset(static_cast<__mtype<_Pattern>*>(nullptr));
struct __impl
{
@@ -1230,9 +1239,10 @@
_Ret, __call_result_t<__mdispatch_<_Args>, _Ts...>...,
__call_result_t<__mdispatch_<_Pattern, _Idx + 1>, _Ts...>...>
{
- return _Ret()( //
- __mdispatch_<_Args>()((_Ts&&)__ts...)..., //
- __mdispatch_<_Pattern, _Idx + 1>()((_Ts&&)__ts...)...);
+ return _Ret()( //
+ __mdispatch_<_Args>()(static_cast<_Ts&&>(__ts)...)..., //
+ __mdispatch_<_Pattern, _Idx + 1>()(
+ static_cast<_Ts&&>(__ts)...)...);
}
};
@@ -1250,7 +1260,7 @@
__impl, __make_indices<sizeof...(_Ts) - __offset - 1>, _Ts...>>
{
return __impl()(__make_indices<sizeof...(_Ts) - __offset - 1>(),
- (_Ts&&)__ts...);
+ static_cast<_Ts&&>(__ts)...);
}
template <class... _Ts>
@@ -1269,7 +1279,7 @@
_Ts...>>
{
return __mdispatch_<__minvoke<__mpop_back<__qf<_Ret>>, _Args...>*>()(
- (_Ts&&)__ts...);
+ static_cast<_Ts&&>(__ts)...);
}
};
diff --git a/include/sdbusplus/async/stdexec/__detail/__ranges.hpp b/include/sdbusplus/async/stdexec/__detail/__ranges.hpp
index f18f84a..e98513e 100644
--- a/include/sdbusplus/async/stdexec/__detail/__ranges.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__ranges.hpp
@@ -45,37 +45,41 @@
void end();
template <class _Ty>
-concept __has_member_begin = requires(_Ty&& __v) { ((_Ty&&)__v).begin(); };
+concept __has_member_begin =
+ requires(_Ty&& __v) { static_cast<_Ty&&>(__v).begin(); };
template <class _Ty>
-concept __has_free_begin = __has_member_begin<_Ty> ||
- requires(_Ty&& __v) { begin(((_Ty&&)__v)); };
+concept __has_free_begin =
+ __has_member_begin<_Ty> ||
+ requires(_Ty&& __v) { begin((static_cast<_Ty&&>(__v))); };
template <class _Ty>
-concept __has_member_end = requires(_Ty&& __v) { ((_Ty&&)__v).end(); };
+concept __has_member_end =
+ requires(_Ty&& __v) { static_cast<_Ty&&>(__v).end(); };
template <class _Ty>
-concept __has_free_end = __has_member_end<_Ty> ||
- requires(_Ty&& __v) { end(((_Ty&&)__v)); };
+concept __has_free_end =
+ __has_member_end<_Ty> ||
+ requires(_Ty&& __v) { end((static_cast<_Ty&&>(__v))); };
struct __begin_t
{
template <class _Range>
requires __has_member_begin<_Range>
auto operator()(_Range&& __rng) const
- noexcept(noexcept(((_Range&&)__rng).begin()))
- -> decltype(((_Range&&)__rng).begin())
+ noexcept(noexcept((static_cast<_Range&&>(__rng)).begin()))
+ -> decltype((static_cast<_Range&&>(__rng)).begin())
{
- return ((_Range&&)__rng).begin();
+ return static_cast<_Range&&>(__rng).begin();
}
template <class _Range>
requires __has_free_begin<_Range>
auto operator()(_Range&& __rng) const
- noexcept(noexcept(begin(((_Range&&)__rng))))
- -> decltype(begin(((_Range&&)__rng)))
+ noexcept(noexcept(begin((static_cast<_Range&&>(__rng)))))
+ -> decltype(begin((static_cast<_Range&&>(__rng))))
{
- return begin(((_Range&&)__rng));
+ return begin((static_cast<_Range&&>(__rng)));
}
};
@@ -84,19 +88,19 @@
template <class _Range>
requires __has_member_end<_Range>
auto operator()(_Range&& __rng) const
- noexcept(noexcept(((_Range&&)__rng).end()))
- -> decltype(((_Range&&)__rng).end())
+ noexcept(noexcept((static_cast<_Range&&>(__rng)).end()))
+ -> decltype((static_cast<_Range&&>(__rng)).end())
{
- return ((_Range&&)__rng).end();
+ return static_cast<_Range&&>(__rng).end();
}
template <class _Range>
requires __has_free_end<_Range>
auto operator()(_Range&& __rng) const
- noexcept(noexcept(end(((_Range&&)__rng))))
- -> decltype(end(((_Range&&)__rng)))
+ noexcept(noexcept(end((static_cast<_Range&&>(__rng)))))
+ -> decltype(end((static_cast<_Range&&>(__rng))))
{
- return end(((_Range&&)__rng));
+ return end((static_cast<_Range&&>(__rng)));
}
};
} // namespace __detail
diff --git a/include/sdbusplus/async/stdexec/__detail/__scope.hpp b/include/sdbusplus/async/stdexec/__detail/__scope.hpp
index 1081269..71129a9 100644
--- a/include/sdbusplus/async/stdexec/__detail/__scope.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__scope.hpp
@@ -27,14 +27,16 @@
template <class _Fn>
struct __scope_guard<_Fn>
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fn __fn_;
- STDEXEC_ATTRIBUTE((no_unique_address)) __immovable __hidden_{};
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fn __fn_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ __immovable __hidden_{};
bool __dismissed_{false};
~__scope_guard()
{
if (!__dismissed_)
- ((_Fn&&)__fn_)();
+ static_cast<_Fn&&>(__fn_)();
}
void __dismiss() noexcept
@@ -46,9 +48,12 @@
template <class _Fn, class _T0>
struct __scope_guard<_Fn, _T0>
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fn __fn_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _T0 __t0_;
- STDEXEC_ATTRIBUTE((no_unique_address)) __immovable __hidden_{};
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fn __fn_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T0 __t0_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ __immovable __hidden_{};
bool __dismissed_{false};
@@ -60,17 +65,21 @@
~__scope_guard()
{
if (!__dismissed_)
- ((_Fn&&)__fn_)((_T0&&)__t0_);
+ static_cast<_Fn&&>(__fn_)(static_cast<_T0&&>(__t0_));
}
};
template <class _Fn, class _T0, class _T1>
struct __scope_guard<_Fn, _T0, _T1>
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fn __fn_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _T0 __t0_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _T1 __t1_;
- STDEXEC_ATTRIBUTE((no_unique_address)) __immovable __hidden_{};
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fn __fn_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T0 __t0_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T1 __t1_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ __immovable __hidden_{};
bool __dismissed_{false};
@@ -82,18 +91,24 @@
~__scope_guard()
{
if (!__dismissed_)
- ((_Fn&&)__fn_)((_T0&&)__t0_, (_T1&&)__t1_);
+ static_cast<_Fn&&>(__fn_)(static_cast<_T0&&>(__t0_),
+ static_cast<_T1&&>(__t1_));
}
};
template <class _Fn, class _T0, class _T1, class _T2>
struct __scope_guard<_Fn, _T0, _T1, _T2>
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fn __fn_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _T0 __t0_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _T1 __t1_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _T2 __t2_;
- STDEXEC_ATTRIBUTE((no_unique_address)) __immovable __hidden_{};
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fn __fn_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T0 __t0_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T1 __t1_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T2 __t2_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ __immovable __hidden_{};
bool __dismissed_{false};
@@ -105,7 +120,9 @@
~__scope_guard()
{
if (!__dismissed_)
- ((_Fn&&)__fn_)((_T0&&)__t0_, (_T1&&)__t1_, (_T2&&)__t2_);
+ static_cast<_Fn&&>(__fn_)(static_cast<_T0&&>(__t0_),
+ static_cast<_T1&&>(__t1_),
+ static_cast<_T2&&>(__t2_));
}
};
diff --git a/include/sdbusplus/async/stdexec/__detail/__tuple.hpp b/include/sdbusplus/async/stdexec/__detail/__tuple.hpp
index d5939f5..b1239a7 100644
--- a/include/sdbusplus/async/stdexec/__detail/__tuple.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__tuple.hpp
@@ -60,7 +60,7 @@
STDEXEC_ATTRIBUTE((always_inline))
constexpr _Ty&& __get(__box<_Ty, _Idx>&& __self) noexcept
{
- return (_Ty&&)__self.__value;
+ return static_cast<_Ty&&>(__self.__value);
}
template <std::size_t _Idx, class _Ty>
@@ -95,7 +95,7 @@
_Ts>...>)
-> __call_result_t<_Fun, __copy_cvref_t<_Tuple, _Ts>...>
{
- return ((_Fun&&)__fun)(
+ return static_cast<_Fun&&>(__fun)(
static_cast<__copy_cvref_t<_Tuple, __box<_Ts, _Idx>>&&>(__tup)
.__value...);
}
@@ -104,10 +104,13 @@
template <class _Fun, __tuple_like _Tuple>
STDEXEC_ATTRIBUTE((always_inline))
constexpr auto __apply(_Fun&& __fun, _Tuple&& __tup) noexcept(
- noexcept(__apply_()((_Fun&&)__fun, (_Tuple&&)__tup, &__tup)))
- -> decltype(__apply_()((_Fun&&)__fun, (_Tuple&&)__tup, &__tup))
+ noexcept(__apply_()(static_cast<_Fun&&>(__fun),
+ static_cast<_Tuple&&>(__tup), &__tup)))
+ -> decltype(__apply_()(static_cast<_Fun&&>(__fun),
+ static_cast<_Tuple&&>(__tup), &__tup))
{
- return __apply_()((_Fun&&)__fun, (_Tuple&&)__tup, &__tup);
+ return __apply_()(static_cast<_Fun&&>(__fun), static_cast<_Tuple&&>(__tup),
+ &__tup);
}
} // namespace __tup
diff --git a/include/sdbusplus/async/stdexec/__detail/__type_traits.hpp b/include/sdbusplus/async/stdexec/__detail/__type_traits.hpp
index 0e8cae5..8b134ed 100644
--- a/include/sdbusplus/async/stdexec/__detail/__type_traits.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__type_traits.hpp
@@ -23,7 +23,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
// A very simple std::declval replacement that doesn't handle void
template <class _Tp>
-_Tp&& __declval() noexcept;
+auto __declval() noexcept -> _Tp&&;
//////////////////////////////////////////////////////////////////////////////////////////////////
// __decay_t: An efficient implementation for std::decay
@@ -189,8 +189,8 @@
namespace __tt
{
template <class _Ty>
-_Ty __remove_rvalue_reference_fn(_Ty&&);
-}
+auto __remove_rvalue_reference_fn(_Ty&&) -> _Ty;
+} // namespace __tt
template <class _Ty>
using __remove_rvalue_reference_t =
diff --git a/include/sdbusplus/async/stdexec/__detail/__utility.hpp b/include/sdbusplus/async/stdexec/__detail/__utility.hpp
index 4d6a1c1..5f3f68a 100644
--- a/include/sdbusplus/async/stdexec/__detail/__utility.hpp
+++ b/include/sdbusplus/async/stdexec/__detail/__utility.hpp
@@ -30,7 +30,7 @@
return static_cast<
typename _Cpcvref::template __f<std::remove_reference_t<_Uy>>>(__uy);
};
-}
+} // namespace __detail
template <class _Ty>
inline constexpr const auto& __forward_like =
diff --git a/include/sdbusplus/async/stdexec/any_sender_of.hpp b/include/sdbusplus/async/stdexec/any_sender_of.hpp
index 6805648..e65118c 100644
--- a/include/sdbusplus/async/stdexec/any_sender_of.hpp
+++ b/include/sdbusplus/async/stdexec/any_sender_of.hpp
@@ -35,8 +35,8 @@
template <class _VTable, class _Tp>
requires __tag_invocable_r<const _VTable*, __create_vtable_t,
__mtype<_VTable>, __mtype<_Tp>>
- constexpr const _VTable* operator()(__mtype<_VTable>,
- __mtype<_Tp>) const noexcept
+ constexpr auto operator()(__mtype<_VTable>, __mtype<_Tp>) const noexcept
+ -> const _VTable*
{
return stdexec::tag_invoke(__create_vtable_t{}, __mtype<_VTable>{},
__mtype<_Tp>{});
@@ -53,9 +53,9 @@
{
_Ret (*__fn_)(void*, _As...);
- _Ret operator()(_Tag, void* __rcvr, _As&&... __as) const
+ auto operator()(_Tag, void* __rcvr, _As&&... __as) const -> _Ret
{
- return __fn_(__rcvr, (_As&&)__as...);
+ return __fn_(__rcvr, static_cast<_As&&>(__as)...);
}
};
@@ -64,9 +64,9 @@
{
_Ret (*__fn_)(void*, _As...);
- _Ret operator()(_Tag, void* __rcvr, _As&&... __as) const
+ auto operator()(_Tag, void* __rcvr, _As&&... __as) const -> _Ret
{
- return __fn_(__rcvr, (_As&&)__as...);
+ return __fn_(__rcvr, static_cast<_As&&>(__as)...);
}
};
@@ -75,9 +75,9 @@
{
_Ret (*__fn_)(void*, _As...) noexcept;
- _Ret operator()(_Tag, void* __rcvr, _As&&... __as) const noexcept
+ auto operator()(_Tag, void* __rcvr, _As&&... __as) const noexcept -> _Ret
{
- return __fn_(__rcvr, (_As&&)__as...);
+ return __fn_(__rcvr, static_cast<_As&&>(__as)...);
}
};
@@ -86,9 +86,9 @@
{
_Ret (*__fn_)(void*, _As...) noexcept;
- _Ret operator()(_Tag, void* __rcvr, _As&&... __as) const noexcept
+ auto operator()(_Tag, void* __rcvr, _As&&... __as) const noexcept -> _Ret
{
- return __fn_(__rcvr, (_As&&)__as...);
+ return __fn_(__rcvr, static_cast<_As&&>(__as)...);
}
};
@@ -105,8 +105,9 @@
const noexcept)(void*, _As...)
{
return +[](void* __env_provider, _As... __as) -> _Ret {
- return _Tag{}(get_env(*(const _EnvProvider*)__env_provider),
- (_As&&)__as...);
+ return _Tag{}(
+ get_env(*static_cast<const _EnvProvider*>(__env_provider)),
+ static_cast<_As&&>(__as)...);
};
}
@@ -119,8 +120,9 @@
static_assert(
__nothrow_callable<_Tag, const env_of_t<_EnvProvider>&,
_As...>);
- return _Tag{}(get_env(*(const _EnvProvider*)__env_provider),
- (_As&&)__as...);
+ return _Tag{}(
+ get_env(*static_cast<const _EnvProvider*>(__env_provider)),
+ static_cast<_As&&>(__as)...);
};
}
};
@@ -135,7 +137,8 @@
const noexcept)(void*, _As...)
{
return +[](void* __queryable, _As... __as) -> _Ret {
- return _Tag{}(*(const _Queryable*)__queryable, (_As&&)__as...);
+ return _Tag{}(*static_cast<const _Queryable*>(__queryable),
+ static_cast<_As&&>(__as)...);
};
}
@@ -146,7 +149,8 @@
{
return +[](void* __env_provider, _As... __as) noexcept -> _Ret {
static_assert(__nothrow_callable<_Tag, const _Queryable&, _As...>);
- return _Tag{}(*(const _Queryable*)__env_provider, (_As&&)__as...);
+ return _Tag{}(*static_cast<const _Queryable*>(__env_provider),
+ static_cast<_As&&>(__as)...);
};
}
};
@@ -161,7 +165,7 @@
void operator()(_Tag, void* __storage, _As&&... __as) const
{
- return __fn_(__storage, (_As&&)__as...);
+ return __fn_(__storage, static_cast<_As&&>(__as)...);
}
};
@@ -172,7 +176,7 @@
void operator()(_Tag, void* __storage, _As&&... __as) const noexcept
{
- return __fn_(__storage, (_As&&)__as...);
+ return __fn_(__storage, static_cast<_As&&>(__as)...);
}
};
@@ -185,8 +189,8 @@
const noexcept)(void*, _As...)
{
return +[](void* __storage, _As... __as) -> void {
- return _Tag{}(__mtype<_Tp>{}, *(_Storage*)__storage,
- (_As&&)__as...);
+ return _Tag{}(__mtype<_Tp>{}, *static_cast<_Storage*>(__storage),
+ static_cast<_As&&>(__as)...);
};
}
@@ -198,8 +202,8 @@
return +[](void* __storage, _As... __as) noexcept -> void {
static_assert(
__nothrow_callable<_Tag, __mtype<_Tp>, _Storage&, _As...>);
- return _Tag{}(__mtype<_Tp>{}, *(_Storage*)__storage,
- (_As&&)__as...);
+ return _Tag{}(__mtype<_Tp>{}, *static_cast<_Storage*>(__storage),
+ static_cast<_As&&>(__as)...);
};
}
};
@@ -248,7 +252,7 @@
static_assert(nothrow_tag_invocable<__move_construct_t, __mtype<_Tp>,
_Storage&, _Storage&&>);
stdexec::tag_invoke(__move_construct_t{}, __mtype<_Tp>{}, __self,
- (_Storage&&)__from);
+ static_cast<_Storage&&>(__from));
}
};
@@ -281,9 +285,9 @@
__null_storage_vtbl{};
template <class _ParentVTable, class... _StorageCPOs>
-constexpr const __storage_vtable<_ParentVTable, _StorageCPOs...>*
- __default_storage_vtable(
- __storage_vtable<_ParentVTable, _StorageCPOs...>*) noexcept
+constexpr auto __default_storage_vtable(
+ __storage_vtable<_ParentVTable, _StorageCPOs...>*) noexcept
+ -> const __storage_vtable<_ParentVTable, _StorageCPOs...>*
{
return &__null_storage_vtbl<_ParentVTable, _StorageCPOs...>;
}
@@ -291,7 +295,8 @@
template <class _Storage, class _Tp, class _ParentVTable, class... _StorageCPOs>
static const __storage_vtable<_ParentVTable, _StorageCPOs...> __storage_vtbl{
{*__create_vtable(__mtype<_ParentVTable>{}, __mtype<_Tp>{})},
- {__storage_vfun_fn<_Storage, _Tp>{}((_StorageCPOs*)nullptr)}...};
+ {__storage_vfun_fn<_Storage, _Tp>{}(
+ static_cast<_StorageCPOs*>(nullptr))}...};
template <class _Vtable, class _Allocator, bool _Copyable = false,
std::size_t _Alignment = alignof(std::max_align_t),
@@ -320,7 +325,8 @@
alignof(_Tp) <= __alignment;
template <class _Tp>
- static constexpr const __vtable_t* __get_vtable_of_type() noexcept
+ static constexpr auto __get_vtable_of_type() noexcept
+ -> const __vtable_t*
{
return &__storage_vtbl<__t, __decay_t<_Tp>, _Vtable, __with_delete>;
}
@@ -338,11 +344,11 @@
using _Dp = __decay_t<_Tp>;
if constexpr (__is_small<_Dp>)
{
- __construct_small<_Dp>((_Tp&&)__object);
+ __construct_small<_Dp>(static_cast<_Tp&&>(__object));
}
else
{
- __construct_large<_Dp>((_Tp&&)__object);
+ __construct_large<_Dp>(static_cast<_Tp&&>(__object));
}
}
@@ -354,11 +360,11 @@
{
if constexpr (__is_small<_Tp>)
{
- __construct_small<_Tp>((_Args&&)__args...);
+ __construct_small<_Tp>(static_cast<_Args&&>(__args)...);
}
else
{
- __construct_large<_Tp>((_Args&&)__args...);
+ __construct_large<_Tp>(static_cast<_Args&&>(__args)...);
}
}
@@ -371,15 +377,16 @@
{
(*__vtable_)(__delete, this);
__object_pointer_ = nullptr;
- __vtable_ = __default_storage_vtable((__vtable_t*)nullptr);
+ __vtable_ =
+ __default_storage_vtable(static_cast<__vtable_t*>(nullptr));
}
- const _Vtable* __get_vtable() const noexcept
+ [[nodiscard]] auto __get_vtable() const noexcept -> const _Vtable*
{
return __vtable_;
}
- void* __get_object_pointer() const noexcept
+ [[nodiscard]] auto __get_object_pointer() const noexcept -> void*
{
return __object_pointer_;
}
@@ -395,8 +402,8 @@
using _Alloc = typename std::allocator_traits<
_Allocator>::template rebind_alloc<_Tp>;
_Alloc __alloc{__allocator_};
- std::allocator_traits<_Alloc>::construct(__alloc, __pointer,
- (_As&&)__args...);
+ std::allocator_traits<_Alloc>::construct(
+ __alloc, __pointer, static_cast<_As&&>(__args)...);
__object_pointer_ = __pointer;
}
@@ -410,8 +417,8 @@
1);
try
{
- std::allocator_traits<_Alloc>::construct(__alloc, __pointer,
- (_As&&)__args...);
+ std::allocator_traits<_Alloc>::construct(
+ __alloc, __pointer, static_cast<_As&&>(__args)...);
}
catch (...)
{
@@ -444,10 +451,11 @@
private:
const __vtable_t* __vtable_{
- __default_storage_vtable((__vtable_t*)nullptr)};
+ __default_storage_vtable(static_cast<__vtable_t*>(nullptr))};
void* __object_pointer_{nullptr};
alignas(__alignment) std::byte __buffer_[__buffer_size]{};
- STDEXEC_ATTRIBUTE((no_unique_address)) _Allocator __allocator_{};
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Allocator __allocator_{};
};
};
@@ -478,7 +486,7 @@
__storage_vtable<_Vtable, __with_delete, __with_move>>;
template <class _Tp>
- static constexpr const __vtable_t* __get_vtable_of_type() noexcept
+ static constexpr auto __get_vtable_of_type() noexcept -> const __vtable_t*
{
if constexpr (_Copyable)
{
@@ -505,11 +513,11 @@
using _Dp = __decay_t<_Tp>;
if constexpr (__is_small<_Dp>)
{
- __construct_small<_Dp>((_Tp&&)__object);
+ __construct_small<_Dp>(static_cast<_Tp&&>(__object));
}
else
{
- __construct_large<_Dp>((_Tp&&)__object);
+ __construct_large<_Dp>(static_cast<_Tp&&>(__object));
}
}
@@ -520,11 +528,11 @@
{
if constexpr (__is_small<_Tp>)
{
- __construct_small<_Tp>((_Args&&)__args...);
+ __construct_small<_Tp>(static_cast<_Args&&>(__args)...);
}
else
{
- __construct_large<_Tp>((_Args&&)__args...);
+ __construct_large<_Tp>(static_cast<_Args&&>(__args)...);
}
}
@@ -534,22 +542,28 @@
(*__other.__vtable_)(__copy_construct, this, __other);
}
- __t& operator=(const __t& __other)
+ auto operator=(const __t& __other) -> __t&
requires(_Copyable)
{
- __t tmp(__other);
- return *this = std::move(tmp);
+ if (&__other != this)
+ {
+ __t tmp(__other);
+ *this = std::move(tmp);
+ }
+ return *this;
}
__t(__t&& __other) noexcept
{
- (*__other.__vtable_)(__move_construct, this, (__t&&)__other);
+ (*__other.__vtable_)(__move_construct, this,
+ static_cast<__t&&>(__other));
}
- __t& operator=(__t&& __other) noexcept
+ auto operator=(__t&& __other) noexcept -> __t&
{
__reset();
- (*__other.__vtable_)(__move_construct, this, (__t&&)__other);
+ (*__other.__vtable_)(__move_construct, this,
+ static_cast<__t&&>(__other));
return *this;
}
@@ -562,15 +576,15 @@
{
(*__vtable_)(__delete, this);
__object_pointer_ = nullptr;
- __vtable_ = __default_storage_vtable((__vtable_t*)nullptr);
+ __vtable_ = __default_storage_vtable(static_cast<__vtable_t*>(nullptr));
}
- const _Vtable* __get_vtable() const noexcept
+ auto __get_vtable() const noexcept -> const _Vtable*
{
return __vtable_;
}
- void* __get_object_pointer() const noexcept
+ [[nodiscard]] auto __get_object_pointer() const noexcept -> void*
{
return __object_pointer_;
}
@@ -586,7 +600,7 @@
_Allocator>::template rebind_alloc<_Tp>;
_Alloc __alloc{__allocator_};
std::allocator_traits<_Alloc>::construct(__alloc, __pointer,
- (_As&&)__args...);
+ static_cast<_As&&>(__args)...);
__object_pointer_ = __pointer;
}
@@ -599,8 +613,8 @@
_Tp* __pointer = std::allocator_traits<_Alloc>::allocate(__alloc, 1);
try
{
- std::allocator_traits<_Alloc>::construct(__alloc, __pointer,
- (_As&&)__args...);
+ std::allocator_traits<_Alloc>::construct(
+ __alloc, __pointer, static_cast<_As&&>(__args)...);
}
catch (...)
{
@@ -642,7 +656,8 @@
if constexpr (__is_small<_Tp>)
{
_Tp& __other_object = *__pointer;
- __self.template __construct_small<_Tp>((_Tp&&)__other_object);
+ __self.template __construct_small<_Tp>(
+ static_cast<_Tp&&>(__other_object));
using _Alloc = typename std::allocator_traits<
_Allocator>::template rebind_alloc<_Tp>;
_Alloc __alloc{__self.__allocator_};
@@ -653,7 +668,8 @@
__self.__object_pointer_ = __pointer;
}
__self.__vtable_ = std::exchange(
- __other.__vtable_, __default_storage_vtable((__vtable_t*)nullptr));
+ __other.__vtable_,
+ __default_storage_vtable(static_cast<__vtable_t*>(nullptr)));
}
template <class _Tp>
@@ -678,18 +694,19 @@
__self.__vtable_ = __other.__vtable_;
}
- const __vtable_t* __vtable_{__default_storage_vtable((__vtable_t*)nullptr)};
+ const __vtable_t* __vtable_{
+ __default_storage_vtable(static_cast<__vtable_t*>(nullptr))};
void* __object_pointer_{nullptr};
alignas(__alignment) std::byte __buffer_[__buffer_size]{};
- STDEXEC_ATTRIBUTE((no_unique_address)) _Allocator __allocator_{};
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Allocator __allocator_{};
};
struct __empty_vtable
{
template <class _Sender>
- friend const __empty_vtable* tag_invoke(__create_vtable_t,
- __mtype<__empty_vtable>,
- __mtype<_Sender>) noexcept
+ friend auto tag_invoke(__create_vtable_t, __mtype<__empty_vtable>,
+ __mtype<_Sender>) noexcept -> const __empty_vtable*
{
static const __empty_vtable __vtable_{};
return &__vtable_;
@@ -707,10 +724,10 @@
using __copyable_storage_t = __t<__storage<_VTable, _Allocator, true>>;
template <class _Tag, class... _As>
-_Tag __tag_type(_Tag (*)(_As...));
+auto __tag_type(_Tag (*)(_As...)) -> _Tag;
template <class _Tag, class... _As>
-_Tag __tag_type(_Tag (*)(_As...) noexcept);
+auto __tag_type(_Tag (*)(_As...) noexcept) -> _Tag;
template <class _Query>
concept __is_stop_token_query = requires {
@@ -753,7 +770,8 @@
const noexcept)(void*, _As...) noexcept
{
return +[](void* __rcvr, _As... __as) noexcept -> void {
- _Tag{}((_Rcvr&&)*(_Rcvr*)__rcvr, (_As&&)__as...);
+ _Tag{}(static_cast<_Rcvr&&>(*static_cast<_Rcvr*>(__rcvr)),
+ static_cast<_As&&>(__as)...);
};
}
};
@@ -770,12 +788,12 @@
template <class _Rcvr>
requires receiver_of<_Rcvr, completion_signatures<_Sigs...>> &&
(__callable<__query_vfun_fn<_Rcvr>, _Queries> && ...)
- friend const __t* tag_invoke(__create_vtable_t, __mtype<__t>,
- __mtype<_Rcvr>) noexcept
+ friend auto tag_invoke(__create_vtable_t, __mtype<__t>,
+ __mtype<_Rcvr>) noexcept -> const __t*
{
static const __t __vtable_{
- {__rcvr_vfun_fn<_Rcvr>{}((_Sigs*)nullptr)}...,
- {__query_vfun_fn<_Rcvr>{}((_Queries) nullptr)}...};
+ {__rcvr_vfun_fn<_Rcvr>{}(static_cast<_Sigs*>(nullptr))}...,
+ {__query_vfun_fn<_Rcvr>{}(static_cast<_Queries>(nullptr))}...};
return &__vtable_;
}
};
@@ -807,11 +825,12 @@
__nothrow_callable<const __vtable_t&, _Tag, void*, _As...>)
-> __call_result_t<const __vtable_t&, _Tag, void*, _As...>
{
- return (*__self.__vtable_)(_Tag{}, __self.__rcvr_, (_As&&)__as...);
+ return (*__self.__vtable_)(_Tag{}, __self.__rcvr_,
+ static_cast<_As&&>(__as)...);
}
- friend in_place_stop_token tag_invoke(get_stop_token_t,
- const __env_t& __self) noexcept
+ friend auto tag_invoke(get_stop_token_t, const __env_t& __self) noexcept
+ -> in_place_stop_token
{
return __self.__token_;
}
@@ -835,24 +854,27 @@
friend void tag_invoke(_Tag, _Self&& __self, _As&&... __as) noexcept
{
(*static_cast<const __rcvr_vfun<_Tag(_As...)>*>(__self.__env_.__vtable_)
- ->__fn_)(((_Self&&)__self).__env_.__rcvr_, (_As&&)__as...);
+ ->__fn_)(static_cast<_Self&&>(__self).__env_.__rcvr_,
+ static_cast<_As&&>(__as)...);
}
template <std::same_as<__ref> Self>
- friend const __env_t& tag_invoke(get_env_t, const Self& __self) noexcept
+ friend auto tag_invoke(get_env_t, const Self& __self) noexcept
+ -> const __env_t&
{
return __self.__env_;
}
};
-__mbool<true> __test_never_stop_token(
- get_stop_token_t (*)(never_stop_token (*)() noexcept));
+auto __test_never_stop_token(
+ get_stop_token_t (*)(never_stop_token (*)() noexcept)) -> __mbool<true>;
template <class _Tag, class _Ret, class... _As>
-__mbool<false> __test_never_stop_token(_Tag (*)(_Ret (*)(_As...) noexcept));
+auto __test_never_stop_token(_Tag (*)(_Ret (*)(_As...) noexcept))
+ -> __mbool<false>;
template <class _Tag, class _Ret, class... _As>
-__mbool<false> __test_never_stop_token(_Tag (*)(_Ret (*)(_As...)));
+auto __test_never_stop_token(_Tag (*)(_Ret (*)(_As...))) -> __mbool<false>;
template <class _Query>
using __is_never_stop_token_query =
@@ -886,7 +908,8 @@
__nothrow_callable<const __vtable_t&, _Tag, void*, _As...>)
-> __call_result_t<const __vtable_t&, _Tag, void*, _As...>
{
- return (*__self.__vtable_)(_Tag{}, __self.__rcvr_, (_As&&)__as...);
+ return (*__self.__vtable_)(_Tag{}, __self.__rcvr_,
+ static_cast<_As&&>(__as)...);
}
} __env_;
@@ -908,11 +931,13 @@
friend void tag_invoke(_Tag, _Self&& __self, _As&&... __as) noexcept
{
(*static_cast<const __rcvr_vfun<_Tag(_As...)>*>(__self.__env_.__vtable_)
- ->__fn_)(((_Self&&)__self).__env_.__rcvr_, (_As&&)__as...);
+ ->__fn_)(static_cast<_Self&&>(__self).__env_.__rcvr_,
+ static_cast<_As&&>(__as)...);
}
template <std::same_as<__ref> Self>
- friend const __env_t& tag_invoke(get_env_t, const Self& __self) noexcept
+ friend auto tag_invoke(get_env_t, const Self& __self) noexcept
+ -> const __env_t&
{
return __self.__env_;
}
@@ -926,9 +951,8 @@
private:
template <class _Op>
- friend const __operation_vtable* tag_invoke(__create_vtable_t,
- __mtype<__operation_vtable>,
- __mtype<_Op>) noexcept
+ friend auto tag_invoke(__create_vtable_t, __mtype<__operation_vtable>,
+ __mtype<_Op>) noexcept -> const __operation_vtable*
{
static __operation_vtable __vtable{
[](void* __object_pointer) noexcept -> void {
@@ -960,7 +984,8 @@
template <class _Receiver>
struct __operation_base
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Receiver __rcvr_;
stdexec::in_place_stop_source __stop_source_{};
using __stop_callback = typename stdexec::stop_token_of_t<
stdexec::env_of_t<_Receiver>>::template callback_type<__on_stop_t>;
@@ -1020,8 +1045,8 @@
}
template <same_as<get_env_t> _GetEnv, same_as<__t> _Self>
- friend __env_t<env_of_t<_Receiver>>
- tag_invoke(_GetEnv, const _Self& __self) noexcept
+ friend auto tag_invoke(_GetEnv, const _Self& __self) noexcept
+ -> __env_t<env_of_t<_Receiver>>
{
return __env::__join(
__env::__with(__self.__op_->__stop_source_.get_token(),
@@ -1083,7 +1108,8 @@
{}
private:
- STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rec_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Receiver __rec_;
__immovable_operation_storage __storage_{};
friend void tag_invoke(start_t, __t& __self) noexcept
@@ -1107,12 +1133,12 @@
private:
template <class _EnvProvider>
requires(__callable<__query_vfun_fn<_EnvProvider>, _Queries> && ...)
- friend const __query_vtable* tag_invoke(__create_vtable_t,
- __mtype<__query_vtable>,
- __mtype<_EnvProvider>) noexcept
+ friend auto tag_invoke(__create_vtable_t, __mtype<__query_vtable>,
+ __mtype<_EnvProvider>) noexcept
+ -> const __query_vtable*
{
- static const __query_vtable __vtable{
- {__query_vfun_fn<_EnvProvider>{}((_Queries) nullptr)}...};
+ static const __query_vtable __vtable{{__query_vfun_fn<_EnvProvider>{}(
+ static_cast<_Queries>(nullptr))}...};
return &__vtable;
}
};
@@ -1131,7 +1157,7 @@
public:
using __id = __vtable;
- const __query_vtable<_SenderQueries>& __queries() const noexcept
+ auto __queries() const noexcept -> const __query_vtable<_SenderQueries>&
{
return *this;
}
@@ -1140,8 +1166,8 @@
private:
template <sender_to<__receiver_ref_t> _Sender>
- friend const __vtable* tag_invoke(__create_vtable_t, __mtype<__vtable>,
- __mtype<_Sender>) noexcept
+ friend auto tag_invoke(__create_vtable_t, __mtype<__vtable>,
+ __mtype<_Sender>) noexcept -> const __vtable*
{
static const __vtable __vtable_{
{*__create_vtable(__mtype<__query_vtable<_SenderQueries>>{},
@@ -1153,8 +1179,9 @@
connect_result_t<_Sender, __receiver_ref_t>;
return __immovable_operation_storage{
std::in_place_type<__op_state_t>, __conv{[&] {
- return stdexec::connect((_Sender&&)__sender,
- (__receiver_ref_t&&)__receiver);
+ return stdexec::connect(
+ static_cast<_Sender&&>(__sender),
+ static_cast<__receiver_ref_t&&>(__receiver));
}}};
}};
return &__vtable_;
@@ -1183,7 +1210,7 @@
void*, _As...>
{
return __self.__vtable_->__queries()(_Tag{}, __self.__sender_,
- (_As&&)__as...);
+ static_cast<_As&&>(__as)...);
}
};
@@ -1195,21 +1222,22 @@
using sender_concept = stdexec::sender_t;
__t(const __t&) = delete;
- __t& operator=(const __t&) = delete;
+ auto operator=(const __t&) -> __t& = delete;
__t(__t&&) = default;
- __t& operator=(__t&&) = default;
+ auto operator=(__t&&) -> __t& = default;
template <__not_decays_to<__t> _Sender>
requires sender_to<_Sender, __receiver_ref<_Sigs, _ReceiverQueries>>
- __t(_Sender&& __sndr) : __storage_{(_Sender&&)__sndr}
+ __t(_Sender&& __sndr) : __storage_{static_cast<_Sender&&>(__sndr)}
{}
- __immovable_operation_storage __connect(__receiver_ref_t __receiver)
+ auto __connect(__receiver_ref_t __receiver)
+ -> __immovable_operation_storage
{
return __storage_.__get_vtable()->__connect_(
__storage_.__get_object_pointer(),
- (__receiver_ref_t&&)__receiver);
+ static_cast<__receiver_ref_t&&>(__receiver));
}
explicit operator bool() const noexcept
@@ -1221,14 +1249,14 @@
__unique_storage_t<__vtable> __storage_;
template <receiver_of<_Sigs> _Rcvr>
- friend stdexec::__t<__operation<stdexec::__id<__decay_t<_Rcvr>>,
+ friend auto tag_invoke(connect_t, __t&& __self, _Rcvr&& __rcvr)
+ -> stdexec::__t<__operation<stdexec::__id<__decay_t<_Rcvr>>,
__with_in_place_stop_token>>
- tag_invoke(connect_t, __t&& __self, _Rcvr&& __rcvr)
{
- return {(__t&&)__self, (_Rcvr&&)__rcvr};
+ return {static_cast<__t&&>(__self), static_cast<_Rcvr&&>(__rcvr)};
}
- friend __env_t tag_invoke(get_env_t, const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept -> __env_t
{
return {__self.__storage_.__get_vtable(),
__self.__storage_.__get_object_pointer()};
@@ -1243,7 +1271,7 @@
template <class _Scheduler>
requires(!__decays_to<_Scheduler, __scheduler>) && scheduler<_Scheduler>
__scheduler(_Scheduler&& __scheduler) :
- __storage_{(_Scheduler&&)__scheduler}
+ __storage_{static_cast<_Scheduler&&>(__scheduler)}
{}
using __sender_t = _ScheduleSender;
@@ -1255,15 +1283,16 @@
__sender_t (*__schedule_)(void*) noexcept;
bool (*__equal_to_)(const void*, const void* other) noexcept;
- const __query_vtable<_SchedulerQueries>& __queries() const noexcept
+ auto __queries() const noexcept
+ -> const __query_vtable<_SchedulerQueries>&
{
return *this;
}
private:
template <scheduler _Scheduler>
- friend const __vtable* tag_invoke(__create_vtable_t, __mtype<__vtable>,
- __mtype<_Scheduler>) noexcept
+ friend auto tag_invoke(__create_vtable_t, __mtype<__vtable>,
+ __mtype<_Scheduler>) noexcept -> const __vtable*
{
static const __vtable __vtable_{
{*__create_vtable(__mtype<__query_vtable<_SchedulerQueries>>{},
@@ -1288,7 +1317,8 @@
};
template <same_as<__scheduler> _Self>
- friend __sender_t tag_invoke(schedule_t, const _Self& __self) noexcept
+ friend auto tag_invoke(schedule_t, const _Self& __self) noexcept
+ -> __sender_t
{
STDEXEC_ASSERT(__self.__storage_.__get_vtable()->__schedule_);
return __self.__storage_.__get_vtable()->__schedule_(
@@ -1305,11 +1335,12 @@
void*, _As...>
{
return __self.__storage_.__get_vtable()->__queries()(
- _Tag{}, __self.__storage_.__get_object_pointer(), (_As&&)__as...);
+ _Tag{}, __self.__storage_.__get_object_pointer(),
+ static_cast<_As&&>(__as)...);
}
- friend bool operator==(const __scheduler& __self,
- const __scheduler& __other) noexcept
+ friend auto operator==(const __scheduler& __self,
+ const __scheduler& __other) noexcept -> bool
{
if (__self.__storage_.__get_vtable() !=
__other.__storage_.__get_vtable())
@@ -1326,8 +1357,8 @@
|| (!__p && !__o);
}
- friend bool operator!=(const __scheduler& __self,
- const __scheduler& __other) noexcept
+ friend auto operator!=(const __scheduler& __self,
+ const __scheduler& __other) noexcept -> bool
{
return !(__self == __other);
}
@@ -1355,8 +1386,9 @@
std::is_nothrow_invocable_v<
_Tag, stdexec::__copy_cvref_t<Self, __receiver_base>, _As...>)
{
- return stdexec::tag_invoke(_Tag{}, ((Self&&)__self).__receiver_,
- (_As&&)__as...);
+ return stdexec::tag_invoke(_Tag{},
+ static_cast<Self&&>(__self).__receiver_,
+ static_cast<_As&&>(__as)...);
}
public:
@@ -1389,8 +1421,9 @@
std::is_nothrow_invocable_v<
_Tag, stdexec::__copy_cvref_t<Self, __sender_base>, _As...>)
{
- return stdexec::tag_invoke(_Tag{}, ((Self&&)__self).__sender_,
- (_As&&)__as...);
+ return stdexec::tag_invoke(_Tag{},
+ static_cast<Self&&>(__self).__sender_,
+ static_cast<_As&&>(__as)...);
}
public:
@@ -1402,7 +1435,7 @@
requires stdexec::sender_to<_Sender, __receiver_base>
any_sender(_Sender&& __sender) noexcept(
stdexec::__nothrow_constructible_from<__sender_base, _Sender>) :
- __sender_((_Sender&&)__sender)
+ __sender_(static_cast<_Sender&&>(__sender))
{}
template <auto... _SchedulerQueries>
@@ -1416,14 +1449,14 @@
any_receiver_ref<__schedule_completions, _ReceiverQueries...>;
template <typename _Tag, typename _Sig>
- static _Tag __ret_fn(_Tag (*const)(_Sig));
+ static auto __ret_fn(_Tag (*const)(_Sig)) -> _Tag;
template <class _Tag>
struct __ret_equals_to
{
template <class _Sig>
- using __f =
- std::is_same<_Tag, decltype(__ret_fn((_Sig) nullptr))>;
+ using __f = std::is_same<
+ _Tag, decltype(__ret_fn(static_cast<_Sig>(nullptr)))>;
};
using schedule_sender_queries = stdexec::__minvoke<
@@ -1464,7 +1497,7 @@
requires(!stdexec::__decays_to<_Scheduler, any_scheduler> &&
stdexec::scheduler<_Scheduler>)
any_scheduler(_Scheduler&& __scheduler) :
- __scheduler_{(_Scheduler&&)__scheduler}
+ __scheduler_{static_cast<_Scheduler&&>(__scheduler)}
{}
private:
@@ -1479,12 +1512,13 @@
_As...>)
{
return stdexec::tag_invoke(
- _Tag{}, ((Self&&)__self).__scheduler_, (_As&&)__as...);
+ _Tag{}, static_cast<Self&&>(__self).__scheduler_,
+ static_cast<_As&&>(__as)...);
}
- friend bool
- operator==(const any_scheduler& __self,
- const any_scheduler& __other) noexcept = default;
+ friend auto operator==(const any_scheduler& __self,
+ const any_scheduler& __other) noexcept
+ -> bool = default;
};
};
};
diff --git a/include/sdbusplus/async/stdexec/async_scope.hpp b/include/sdbusplus/async/stdexec/async_scope.hpp
index 524f11c..63f38d6 100644
--- a/include/sdbusplus/async/stdexec/async_scope.hpp
+++ b/include/sdbusplus/async/stdexec/async_scope.hpp
@@ -74,7 +74,8 @@
explicit __t(const __impl* __scope, _Constrained&& __sndr,
_Receiver __rcvr) :
__task{{}, __scope, __notify_waiter},
- __op_(stdexec::connect((_Constrained&&)__sndr, (_Receiver&&)__rcvr))
+ __op_(stdexec::connect(static_cast<_Constrained&&>(__sndr),
+ static_cast<_Receiver&&>(__rcvr)))
{}
private:
@@ -124,11 +125,13 @@
template <__decays_to<__t> _Self, receiver _Receiver>
requires sender_to<__copy_cvref_t<_Self, _Constrained>, _Receiver>
- [[nodiscard]] friend __when_empty_op_t<_Self, _Receiver>
- tag_invoke(connect_t, _Self&& __self, _Receiver __rcvr)
+ [[nodiscard]] friend auto tag_invoke(connect_t, _Self&& __self,
+ _Receiver __rcvr)
+ -> __when_empty_op_t<_Self, _Receiver>
{
return __when_empty_op_t<_Self, _Receiver>{
- __self.__scope_, ((_Self&&)__self).__c_, (_Receiver&&)__rcvr};
+ __self.__scope_, static_cast<_Self&&>(__self).__c_,
+ static_cast<_Receiver&&>(__rcvr)};
}
template <__decays_to<__t> _Self, class _Env>
@@ -139,13 +142,14 @@
return {};
}
- friend empty_env tag_invoke(get_env_t, const __t&) noexcept
+ friend auto tag_invoke(get_env_t, const __t&) noexcept -> empty_env
{
return {};
}
const __impl* __scope_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Constrained __c_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Constrained __c_;
};
};
@@ -160,7 +164,8 @@
{
using _Receiver = stdexec::__t<_ReceiverId>;
const __impl* __scope_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Receiver __rcvr_;
};
template <class _ReceiverId>
@@ -198,14 +203,15 @@
friend void tag_invoke(_Tag, __t&& __self, _As&&... __as) noexcept
{
auto __scope = __self.__op_->__scope_;
- _Tag{}(std::move(__self.__op_->__rcvr_), (_As&&)__as...);
+ _Tag{}(std::move(__self.__op_->__rcvr_),
+ static_cast<_As&&>(__as)...);
// do not access __op_
// do not access this
__complete(__scope);
}
- friend __env_t<env_of_t<_Receiver>>
- tag_invoke(get_env_t, const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> __env_t<env_of_t<_Receiver>>
{
return make_env(
get_env(__self.__op_->__rcvr_),
@@ -231,8 +237,10 @@
template <__decays_to<_Constrained> _Sender,
__decays_to<_Receiver> _Rcvr>
explicit __t(const __impl* __scope, _Sender&& __c, _Rcvr&& __rcvr) :
- __nest_op_base<_ReceiverId>{{}, __scope, (_Rcvr&&)__rcvr},
- __op_(stdexec::connect((_Sender&&)__c, __nest_rcvr_t{this}))
+ __nest_op_base<_ReceiverId>{
+ {}, __scope, static_cast<_Rcvr&&>(__rcvr)},
+ __op_(stdexec::connect(static_cast<_Sender&&>(__c),
+ __nest_rcvr_t{this}))
{}
private:
@@ -264,7 +272,8 @@
using sender_concept = stdexec::sender_t;
const __impl* __scope_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Constrained __c_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Constrained __c_;
template <class _Receiver>
using __nest_operation_t =
@@ -276,11 +285,13 @@
template <__decays_to<__t> _Self, receiver _Receiver>
requires sender_to<__copy_cvref_t<_Self, _Constrained>,
__nest_receiver_t<_Receiver>>
- [[nodiscard]] friend __nest_operation_t<_Receiver>
- tag_invoke(connect_t, _Self&& __self, _Receiver __rcvr)
+ [[nodiscard]] friend auto tag_invoke(connect_t, _Self&& __self,
+ _Receiver __rcvr)
+ -> __nest_operation_t<_Receiver>
{
return __nest_operation_t<_Receiver>{
- __self.__scope_, ((_Self&&)__self).__c_, (_Receiver&&)__rcvr};
+ __self.__scope_, static_cast<_Self&&>(__self).__c_,
+ static_cast<_Receiver&&>(__rcvr)};
}
template <__decays_to<__t> _Self, class _Env>
@@ -291,7 +302,7 @@
return {};
}
- friend empty_env tag_invoke(get_env_t, const __t&) noexcept
+ friend auto tag_invoke(get_env_t, const __t&) noexcept -> empty_env
{
return {};
}
@@ -373,7 +384,7 @@
else if (get_stop_token(get_env(__rcvr_)).stop_requested())
{
__guard.unlock();
- set_stopped((_Receiver&&)__rcvr_);
+ set_stopped(static_cast<_Receiver&&>(__rcvr_));
__guard.lock();
}
else
@@ -390,7 +401,8 @@
[this, &__guard]<class... _As>(auto tag,
_As&... __as) {
__guard.unlock();
- tag((_Receiver&&)__rcvr_, (_As&&)__as...);
+ tag(static_cast<_Receiver&&>(__rcvr_),
+ static_cast<_As&&>(__as)...);
__guard.lock();
},
__tup);
@@ -401,7 +413,8 @@
}
catch (...)
{
- set_error((_Receiver&&)__rcvr_, std::current_exception());
+ set_error(static_cast<_Receiver&&>(__rcvr_),
+ std::current_exception());
}
}
@@ -425,11 +438,13 @@
}
catch (...)
{
- set_error((_Receiver&&)__rcvr_, std::current_exception());
+ set_error(static_cast<_Receiver&&>(__rcvr_),
+ std::current_exception());
}
}
- STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Receiver __rcvr_;
std::unique_ptr<__future_state<_Sender, _Env>> __state_;
STDEXEC_ATTRIBUTE((no_unique_address))
__forward_consumer __forward_consumer_;
@@ -462,7 +477,8 @@
[](__subscription* __self) noexcept -> void {
static_cast<__t*>(__self)->__complete_();
}},
- __rcvr_((_Receiver2&&)__rcvr), __state_(std::move(__state)),
+ __rcvr_(static_cast<_Receiver2&&>(__rcvr)),
+ __state_(std::move(__state)),
__forward_consumer_(get_stop_token(get_env(__rcvr_)),
__forward_stopped{&__state_->__stop_source_})
{}
@@ -484,10 +500,10 @@
#else
template <class _Tag, class... _Ts>
-std::tuple<_Tag, _Ts...> __completion_as_tuple_(_Tag (*)(_Ts&&...));
+auto __completion_as_tuple_(_Tag (*)(_Ts&&...)) -> std::tuple<_Tag, _Ts...>;
template <class _Fn>
using __completion_as_tuple_t =
- decltype(__scope::__completion_as_tuple_((_Fn*)nullptr));
+ decltype(__scope::__completion_as_tuple_(static_cast<_Fn*>(nullptr)));
#endif
template <class... _Ts>
@@ -524,7 +540,7 @@
template <class _Uy>
requires convertible_to<_Uy*, _Ty*>
- __dynamic_delete& operator=(std::default_delete<_Uy> __d)
+ auto operator=(std::default_delete<_Uy> __d) -> __dynamic_delete&
{
__delete_ = __dynamic_delete{__d}.__delete_;
return *this;
@@ -545,7 +561,7 @@
__forward_scope_{std::in_place, __scope->__stop_source_.get_token(),
__forward_stopped{&__stop_source_}},
__env_(
- make_env((_Env&&)__env,
+ make_env(static_cast<_Env&&>(__env),
with(get_stop_token, __scope->__stop_source_.get_token())))
{}
@@ -630,8 +646,8 @@
{
std::unique_lock __guard{__state.__mutex_};
using _Tuple = __decayed_tuple<_Tag, _As...>;
- __state.__data_.template emplace<_Tuple>(_Tag{},
- (_As&&)__as...);
+ __state.__data_.template emplace<_Tuple>(
+ _Tag{}, static_cast<_As&&>(__as)...);
__guard.unlock();
__self.__dispatch_result_();
}
@@ -643,8 +659,8 @@
}
}
- friend const __env_t<_Env>& tag_invoke(get_env_t,
- const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> const __env_t<_Env>&
{
return __self.__state_->__env_;
}
@@ -662,9 +678,10 @@
using _Completions = __future_completions_t<_Sender, _Env>;
__future_state(_Sender __sndr, _Env __env, const __impl* __scope) :
- __future_state_base<_Completions, _Env>((_Env&&)__env, __scope),
+ __future_state_base<_Completions, _Env>(static_cast<_Env&&>(__env),
+ __scope),
__op_(
- stdexec::connect((_Sender&&)__sndr,
+ stdexec::connect(static_cast<_Sender&&>(__sndr),
__future_receiver_t<_Sender, _Env>{this, __scope}))
{}
@@ -683,7 +700,7 @@
using sender_concept = stdexec::sender_t;
__t(__t&&) = default;
- __t& operator=(__t&&) = default;
+ auto operator=(__t&&) -> __t& = default;
~__t() noexcept
{
@@ -724,10 +741,10 @@
template <__decays_to<__t> _Self, receiver _Receiver>
requires receiver_of<_Receiver, __completions_t<_Self>>
- friend __future_op_t<_Receiver> tag_invoke(connect_t, _Self&& __self,
- _Receiver __rcvr)
+ friend auto tag_invoke(connect_t, _Self&& __self, _Receiver __rcvr)
+ -> __future_op_t<_Receiver>
{
- return __future_op_t<_Receiver>{(_Receiver&&)__rcvr,
+ return __future_op_t<_Receiver>{static_cast<_Receiver&&>(__rcvr),
std::move(__self.__state_)};
}
@@ -738,7 +755,7 @@
return {};
}
- friend empty_env tag_invoke(get_env_t, const __t&) noexcept
+ friend auto tag_invoke(get_env_t, const __t&) noexcept -> empty_env
{
return {};
}
@@ -791,8 +808,8 @@
std::rethrow_exception(std::move(__eptr));
}
- friend const __spawn_env_t<_Env>& tag_invoke(get_env_t,
- const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> const __spawn_env_t<_Env>&
{
return __self.__op_->__env_;
}
@@ -814,14 +831,14 @@
__t(_Sndr&& __sndr, _Env __env, const __impl* __scope) :
__spawn_op_base<_EnvId>{
__env::__join(
- (_Env&&)__env,
+ static_cast<_Env&&>(__env),
__env::__with(__scope->__stop_source_.get_token(),
get_stop_token),
__env::__with(__inln::__scheduler{}, get_scheduler)),
[](__spawn_op_base<_EnvId>* __op) {
delete static_cast<__t*>(__op);
}},
- __op_(stdexec::connect((_Sndr&&)__sndr,
+ __op_(stdexec::connect(static_cast<_Sndr&&>(__sndr),
__spawn_receiver_t<_Env>{this}))
{}
@@ -849,11 +866,11 @@
async_scope() = default;
template <sender _Constrained>
- [[nodiscard]] __when_empty_sender_t<_Constrained>
- when_empty(_Constrained&& __c) const
+ [[nodiscard]] auto when_empty(_Constrained&& __c) const
+ -> __when_empty_sender_t<_Constrained>
{
- return __when_empty_sender_t<_Constrained>{&__impl_,
- (_Constrained&&)__c};
+ return __when_empty_sender_t<_Constrained>{
+ &__impl_, static_cast<_Constrained&&>(__c)};
}
[[nodiscard]] auto on_empty() const
@@ -865,9 +882,10 @@
using nest_result_t = __nest_sender_t<_Constrained>;
template <sender _Constrained>
- [[nodiscard]] nest_result_t<_Constrained> nest(_Constrained&& __c)
+ [[nodiscard]] auto nest(_Constrained&& __c) -> nest_result_t<_Constrained>
{
- return nest_result_t<_Constrained>{&__impl_, (_Constrained&&)__c};
+ return nest_result_t<_Constrained>{&__impl_,
+ static_cast<_Constrained&&>(__c)};
}
template <__movable_value _Env = empty_env,
@@ -879,32 +897,34 @@
// start is noexcept so we can assume that the operation will complete
// after this, which means we can rely on its self-ownership to ensure
// that it is eventually deleted
- stdexec::start(
- *new __op_t{nest((_Sender&&)__sndr), (_Env&&)__env, &__impl_});
+ stdexec::start(*new __op_t{nest(static_cast<_Sender&&>(__sndr)),
+ static_cast<_Env&&>(__env), &__impl_});
}
template <__movable_value _Env = empty_env,
sender_in<__env_t<_Env>> _Sender>
- __future_t<_Sender, _Env> spawn_future(_Sender&& __sndr, _Env __env = {})
+ auto spawn_future(_Sender&& __sndr, _Env __env = {})
+ -> __future_t<_Sender, _Env>
{
using __state_t = __future_state<nest_result_t<_Sender>, _Env>;
- auto __state = std::make_unique<__state_t>(nest((_Sender&&)__sndr),
- (_Env&&)__env, &__impl_);
+ auto __state =
+ std::make_unique<__state_t>(nest(static_cast<_Sender&&>(__sndr)),
+ static_cast<_Env&&>(__env), &__impl_);
stdexec::start(__state->__op_);
return __future_t<_Sender, _Env>{std::move(__state)};
}
- in_place_stop_source& get_stop_source() noexcept
+ auto get_stop_source() noexcept -> in_place_stop_source&
{
return __impl_.__stop_source_;
}
- in_place_stop_token get_stop_token() const noexcept
+ auto get_stop_token() const noexcept -> in_place_stop_token
{
return __impl_.__stop_source_.get_token();
}
- bool request_stop() noexcept
+ auto request_stop() noexcept -> bool
{
return __impl_.__stop_source_.request_stop();
}
diff --git a/include/sdbusplus/async/stdexec/at_coroutine_exit.hpp b/include/sdbusplus/async/stdexec/at_coroutine_exit.hpp
index f299244..6bb5318 100644
--- a/include/sdbusplus/async/stdexec/at_coroutine_exit.hpp
+++ b/include/sdbusplus/async/stdexec/at_coroutine_exit.hpp
@@ -54,7 +54,8 @@
friend void tag_invoke(_Tag, _Self&& __self,
_Args&&... __args) noexcept
{
- _Tag{}((_Receiver&&)__self.__receiver_, (_Args&&)__args...);
+ _Tag{}(static_cast<_Receiver&&>(__self.__receiver_),
+ static_cast<_Args&&>(__args)...);
}
template <same_as<set_stopped_t> _Tag>
@@ -63,8 +64,8 @@
std::terminate();
}
- friend env_of_t<_Receiver> tag_invoke(get_env_t,
- const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> env_of_t<_Receiver>
{
return get_env(__self.__receiver_);
}
@@ -90,12 +91,13 @@
template <receiver _Receiver>
requires sender_to<_Sender, __receiver<_Receiver>>
- friend connect_result_t<_Sender, __receiver<_Receiver>>
- tag_invoke(connect_t, __t&& __self, _Receiver&& __rcvr) noexcept
+ friend auto tag_invoke(connect_t, __t&& __self,
+ _Receiver&& __rcvr) noexcept
+ -> connect_result_t<_Sender, __receiver<_Receiver>>
{
return stdexec::connect(
- (_Sender&&)__self.__sender_,
- __receiver<_Receiver>{(_Receiver&&)__rcvr});
+ static_cast<_Sender&&>(__self.__sender_),
+ __receiver<_Receiver>{static_cast<_Receiver&&>(__rcvr)});
}
template <__decays_to<__t> _Self, class _Env>
@@ -105,8 +107,8 @@
return {};
}
- friend env_of_t<_Sender> tag_invoke(get_env_t,
- const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> env_of_t<_Sender>
{
return get_env(__self.__sender_);
}
@@ -116,16 +118,16 @@
using __sender = __t<__sender_id<__decay_t<_Sender>>>;
template <sender _Sender>
- __sender<_Sender> operator()(_Sender&& __sndr) const
- noexcept(__nothrow_decay_copyable<_Sender>)
+ auto operator()(_Sender&& __sndr) const
+ noexcept(__nothrow_decay_copyable<_Sender>) -> __sender<_Sender>
{
- return __sender<_Sender>{(_Sender&&)__sndr};
+ return __sender<_Sender>{static_cast<_Sender&&>(__sndr)};
}
template <class _Value>
- _Value&& operator()(_Value&& __value) const noexcept
+ auto operator()(_Value&& __value) const noexcept -> _Value&&
{
- return (_Value&&)__value;
+ return static_cast<_Value&&>(__value);
}
};
@@ -158,13 +160,14 @@
__coro_(std::exchange(__that.__coro_, {}))
{}
- bool await_ready() const noexcept
+ [[nodiscard]] auto await_ready() const noexcept -> bool
{
return false;
}
template <__has_continuation _Promise>
- bool await_suspend(__coro::coroutine_handle<_Promise> __parent) noexcept
+ auto await_suspend(__coro::coroutine_handle<_Promise> __parent) noexcept
+ -> bool
{
__coro_.promise().__scheduler_ =
get_scheduler(get_env(__parent.promise()));
@@ -173,7 +176,7 @@
return false;
}
- std::tuple<_Ts&...> await_resume() noexcept
+ auto await_resume() noexcept -> std::tuple<_Ts&...>
{
return std::exchange(__coro_, {}).promise().__args_;
}
@@ -181,13 +184,14 @@
private:
struct __final_awaitable
{
- static constexpr bool await_ready() noexcept
+ static constexpr auto await_ready() noexcept -> bool
{
return false;
}
- static __coro::coroutine_handle<>
+ static auto
await_suspend(__coro::coroutine_handle<__promise> __h) noexcept
+ -> __coro::coroutine_handle<>
{
__promise& __p = __h.promise();
auto __coro = __p.__is_unhandled_stopped_
@@ -203,8 +207,8 @@
{
const __promise& __promise_;
- friend __any_scheduler tag_invoke(get_scheduler_t,
- __env __self) noexcept
+ friend auto tag_invoke(get_scheduler_t, __env __self) noexcept
+ -> __any_scheduler
{
return __self.__promise_.__scheduler_;
}
@@ -216,12 +220,12 @@
explicit __promise(_Action&&, _Ts&... __ts) noexcept : __args_{__ts...}
{}
- __coro::suspend_always initial_suspend() noexcept
+ auto initial_suspend() noexcept -> __coro::suspend_always
{
return {};
}
- __final_awaitable final_suspend() noexcept
+ auto final_suspend() noexcept -> __final_awaitable
{
return {};
}
@@ -233,26 +237,28 @@
std::terminate();
}
- __coro::coroutine_handle<__promise> unhandled_stopped() noexcept
+ auto unhandled_stopped() noexcept -> __coro::coroutine_handle<__promise>
{
__is_unhandled_stopped_ = true;
return __coro::coroutine_handle<__promise>::from_promise(*this);
}
- __task get_return_object() noexcept
+ auto get_return_object() noexcept -> __task
{
return __task(
__coro::coroutine_handle<__promise>::from_promise(*this));
}
template <class _Awaitable>
- decltype(auto) await_transform(_Awaitable&& __awaitable) noexcept
+ auto await_transform(_Awaitable&& __awaitable) noexcept
+ -> decltype(auto)
{
- return as_awaitable(__die_on_stop((_Awaitable&&)__awaitable),
- *this);
+ return as_awaitable(
+ __die_on_stop(static_cast<_Awaitable&&>(__awaitable)), *this);
}
- friend __env tag_invoke(get_env_t, const __promise& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __promise& __self) noexcept
+ -> __env
{
return {__self};
}
@@ -269,17 +275,18 @@
{
private:
template <class _Action, class... _Ts>
- static __task<_Ts...> __impl(_Action __action, _Ts... __ts)
+ static auto __impl(_Action __action, _Ts... __ts) -> __task<_Ts...>
{
- co_await ((_Action&&)__action)((_Ts&&)__ts...);
+ co_await static_cast<_Action&&>(__action)(static_cast<_Ts&&>(__ts)...);
}
public:
template <class _Action, class... _Ts>
requires __callable<__decay_t<_Action>, __decay_t<_Ts>...>
- __task<_Ts...> operator()(_Action&& __action, _Ts&&... __ts) const
+ auto operator()(_Action&& __action, _Ts&&... __ts) const -> __task<_Ts...>
{
- return __impl((_Action&&)__action, (_Ts&&)__ts...);
+ return __impl(static_cast<_Action&&>(__action),
+ static_cast<_Ts&&>(__ts)...);
}
};
} // namespace __at_coro_exit
diff --git a/include/sdbusplus/async/stdexec/commit.info b/include/sdbusplus/async/stdexec/commit.info
index 0e54be9..68da718 100644
--- a/include/sdbusplus/async/stdexec/commit.info
+++ b/include/sdbusplus/async/stdexec/commit.info
@@ -1 +1 @@
-2c19548b9e38f54ef7b8d8d4e49920afe43b9ede
+af0efa96811682e26c123175746c408fa582dbb1
diff --git a/include/sdbusplus/async/stdexec/concepts.hpp b/include/sdbusplus/async/stdexec/concepts.hpp
index 79a9740..5963932 100644
--- a/include/sdbusplus/async/stdexec/concepts.hpp
+++ b/include/sdbusplus/async/stdexec/concepts.hpp
@@ -94,7 +94,7 @@
inline constexpr bool __destructible_ = //
requires {
{
- ((_Ty && (*)() noexcept) nullptr)().~_Ty()
+ (static_cast < _Ty && (*)() noexcept > (nullptr))().~_Ty()
} noexcept;
};
template <class _Ty>
@@ -143,7 +143,7 @@
// const std::remove_reference_t<_RHS>&> &&
requires(_LHS __lhs, _RHS&& __rhs) {
{
- __lhs = ((_RHS&&)__rhs)
+ __lhs = static_cast<_RHS&&>(__rhs)
} -> same_as<_LHS>;
};
@@ -154,13 +154,13 @@
template <class _Ty, class _Uy>
concept swappable_with = //
requires(_Ty&& __t, _Uy&& __u) { //
- swap((_Ty&&)__t, (_Uy&&)__u);
+ swap(static_cast<_Ty&&>(__t), static_cast<_Uy&&>(__u));
};
inline constexpr const auto __fn = //
[]<class _Ty, swappable_with<_Ty> _Uy>(_Ty&& __t, _Uy&& __u) noexcept(
- noexcept(swap((_Ty&&)__t, (_Uy&&)__u))) {
- swap((_Ty&&)__t, (_Uy&&)__u);
+ noexcept(swap(static_cast<_Ty&&>(__t), static_cast<_Uy&&>(__u)))) {
+ swap(static_cast<_Ty&&>(__t), static_cast<_Uy&&>(__u));
};
} // namespace __swap
@@ -244,7 +244,7 @@
__movable_value<_Ty> && //
requires(_Ty&& __t) {
{
- __decay_t<_Ty>{__decay_t<_Ty>{(_Ty&&)__t}}
+ __decay_t<_Ty>{__decay_t<_Ty>{static_cast<_Ty&&>(__t)}}
} noexcept;
};
diff --git a/include/sdbusplus/async/stdexec/coroutine.hpp b/include/sdbusplus/async/stdexec/coroutine.hpp
index b5f9645..01fb2fc 100644
--- a/include/sdbusplus/async/stdexec/coroutine.hpp
+++ b/include/sdbusplus/async/stdexec/coroutine.hpp
@@ -62,61 +62,78 @@
template <class _Awaitable>
void __co_await_constraint(_Awaitable&& __awaitable)
- requires requires { operator co_await((_Awaitable&&)__awaitable); };
+ requires requires {
+ operator co_await(static_cast<_Awaitable&&>(__awaitable));
+ };
#endif
template <class _Awaitable>
-decltype(auto) __get_awaiter(_Awaitable&& __awaitable, void*)
-{
- if constexpr (requires { ((_Awaitable&&)__awaitable).operator co_await(); })
- {
- return ((_Awaitable&&)__awaitable).operator co_await();
- }
- else if constexpr (requires {
-#if STDEXEC_MSVC()
- __co_await_constraint((_Awaitable&&)__awaitable);
-#else
- operator co_await((_Awaitable&&) __awaitable);
-#endif
- })
- {
- return operator co_await((_Awaitable&&)__awaitable);
- }
- else
- {
- return (_Awaitable&&)__awaitable;
- }
-}
-
-template <class _Awaitable, class _Promise>
-decltype(auto) __get_awaiter(_Awaitable&& __awaitable, _Promise* __promise)
- requires requires { __promise->await_transform((_Awaitable&&)__awaitable); }
+auto __get_awaiter(_Awaitable&& __awaitable, void*) -> decltype(auto)
{
if constexpr (requires {
- __promise->await_transform((_Awaitable&&)__awaitable)
+ static_cast<_Awaitable&&>(__awaitable)
.
operator co_await();
})
{
- return __promise->await_transform((_Awaitable&&)__awaitable)
+ return static_cast<_Awaitable&&>(__awaitable).operator co_await();
+ }
+ else if constexpr (requires {
+#if STDEXEC_MSVC()
+ __co_await_constraint(
+ static_cast<_Awaitable&&>(__awaitable));
+#else
+ operator co_await(
+ static_cast<_Awaitable&&>(__awaitable));
+#endif
+ })
+ {
+ return operator co_await(static_cast<_Awaitable&&>(__awaitable));
+ }
+ else
+ {
+ return static_cast<_Awaitable&&>(__awaitable);
+ }
+}
+
+template <class _Awaitable, class _Promise>
+auto __get_awaiter(_Awaitable&& __awaitable, _Promise* __promise)
+ -> decltype(auto)
+ requires requires {
+ __promise->await_transform(
+ static_cast<_Awaitable&&>(__awaitable));
+ }
+{
+ if constexpr (requires {
+ __promise
+ ->await_transform(
+ static_cast<_Awaitable&&>(__awaitable))
+ .
+ operator co_await();
+ })
+ {
+ return __promise
+ ->await_transform(static_cast<_Awaitable&&>(__awaitable))
.
operator co_await();
}
else if constexpr (requires {
#if STDEXEC_MSVC()
__co_await_constraint(__promise->await_transform(
- (_Awaitable&&)__awaitable));
+ static_cast<_Awaitable&&>(__awaitable)));
#else
- operator co_await(__promise->await_transform((_Awaitable&&) __awaitable));
+ operator co_await(__promise->await_transform(
+ static_cast<_Awaitable&&>(__awaitable)));
#endif
})
{
return operator co_await(
- __promise->await_transform((_Awaitable&&)__awaitable));
+ __promise->await_transform(static_cast<_Awaitable&&>(__awaitable)));
}
else
{
- return __promise->await_transform((_Awaitable&&)__awaitable);
+ return __promise->await_transform(
+ static_cast<_Awaitable&&>(__awaitable));
}
}
@@ -124,19 +141,20 @@
concept __awaitable = //
requires(_Awaitable&& __awaitable, _Promise* __promise) {
{
- stdexec::__get_awaiter((_Awaitable&&)__awaitable, __promise)
+ stdexec::__get_awaiter(static_cast<_Awaitable&&>(__awaitable),
+ __promise)
} -> __awaiter<_Promise>;
};
template <class _Tp>
-_Tp& __as_lvalue(_Tp&&);
+auto __as_lvalue(_Tp&&) -> _Tp&;
template <class _Awaitable, class _Promise = void>
requires __awaitable<_Awaitable, _Promise>
using __await_result_t =
decltype(stdexec::__as_lvalue(
stdexec::__get_awaiter(std::declval<_Awaitable>(),
- (_Promise*)nullptr))
+ static_cast<_Promise*>(nullptr)))
.await_resume());
#else
diff --git a/include/sdbusplus/async/stdexec/env.hpp b/include/sdbusplus/async/stdexec/env.hpp
index 4df755c..d83948a 100644
--- a/include/sdbusplus/async/stdexec/env.hpp
+++ b/include/sdbusplus/async/stdexec/env.hpp
@@ -32,16 +32,16 @@
template <class _Tag, class _Value>
auto operator()(_Tag, _Value&& __val) const
{
- return stdexec::__env::__with((_Value&&)__val, _Tag());
+ return stdexec::__env::__with(static_cast<_Value&&>(__val), _Tag());
}
};
struct __without_t
{
template <class _Env, class _Tag>
- decltype(auto) operator()(_Env&& __env, _Tag) const
+ auto operator()(_Env&& __env, _Tag) const -> decltype(auto)
{
- return stdexec::__env::__without((_Env&&)__env, _Tag());
+ return stdexec::__env::__without(static_cast<_Env&&>(__env), _Tag());
}
};
@@ -54,13 +54,14 @@
auto operator()(_Base&& __base, _Env&& __env) const noexcept
-> stdexec::__env::__join_t<_Env, _Base>
{
- return stdexec::__env::__join((_Env&&)__env, (_Base&&)__base);
+ return stdexec::__env::__join(static_cast<_Env&&>(__env),
+ static_cast<_Base&&>(__base));
}
template <stdexec::__nothrow_move_constructible _Env>
- _Env operator()(_Env&& __env) const noexcept
+ auto operator()(_Env&& __env) const noexcept -> _Env
{
- return (_Env&&)__env;
+ return static_cast<_Env&&>(__env);
}
};
} // namespace __envs
@@ -88,7 +89,8 @@
{
using __id = __operation;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Default __default_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Default __default_;
_Receiver __rcvr_;
friend void tag_invoke(start_t, __t& __self) noexcept
@@ -123,7 +125,8 @@
using __id = __sender;
using __t = __sender;
using sender_concept = stdexec::sender_t;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Default __default_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Default __default_;
template <class _Env>
using __value_t = __minvoke<
@@ -141,7 +144,9 @@
noexcept(std::is_nothrow_move_constructible_v<_Receiver>)
-> __operation_t<_Tag, __default_t<env_of_t<_Receiver>>, _Receiver>
{
- return {{}, ((_Self&&)__self).__default_, (_Receiver&&)__rcvr};
+ return {{},
+ static_cast<_Self&&>(__self).__default_,
+ static_cast<_Receiver&&>(__rcvr)};
}
template <class _Env>
@@ -158,7 +163,7 @@
constexpr auto operator()(_Tag, _Default&& __default) const
-> __sender<_Tag, __decay_t<_Default>>
{
- return {(_Default&&)__default};
+ return {static_cast<_Default&&>(__default)};
}
};
} // namespace __read_with_default
diff --git a/include/sdbusplus/async/stdexec/execution.hpp b/include/sdbusplus/async/stdexec/execution.hpp
index 36c5013..8286020 100644
--- a/include/sdbusplus/async/stdexec/execution.hpp
+++ b/include/sdbusplus/async/stdexec/execution.hpp
@@ -80,12 +80,12 @@
template <class _Receiver, class... _As>
requires tag_invocable<set_value_t, _Receiver, _As...>
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
- void
+ STDEXEC_ATTRIBUTE((host, device, always_inline)) void
operator()(_Receiver&& __rcvr, _As&&... __as) const noexcept
{
static_assert(nothrow_tag_invocable<set_value_t, _Receiver, _As...>);
- (void)tag_invoke(set_value_t{}, (_Receiver&&)__rcvr, (_As&&)__as...);
+ (void)tag_invoke(set_value_t{}, static_cast<_Receiver&&>(__rcvr),
+ static_cast<_As&&>(__as)...);
}
};
@@ -97,12 +97,12 @@
template <class _Receiver, class _Error>
requires tag_invocable<set_error_t, _Receiver, _Error>
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
- void
+ STDEXEC_ATTRIBUTE((host, device, always_inline)) void
operator()(_Receiver&& __rcvr, _Error&& __err) const noexcept
{
static_assert(nothrow_tag_invocable<set_error_t, _Receiver, _Error>);
- (void)tag_invoke(set_error_t{}, (_Receiver&&)__rcvr, (_Error&&)__err);
+ (void)tag_invoke(set_error_t{}, static_cast<_Receiver&&>(__rcvr),
+ static_cast<_Error&&>(__err));
}
};
@@ -114,12 +114,11 @@
template <class _Receiver>
requires tag_invocable<set_stopped_t, _Receiver>
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
- void
+ STDEXEC_ATTRIBUTE((host, device, always_inline)) void
operator()(_Receiver&& __rcvr) const noexcept
{
static_assert(nothrow_tag_invocable<set_stopped_t, _Receiver>);
- (void)tag_invoke(set_stopped_t{}, (_Receiver&&)__rcvr);
+ (void)tag_invoke(set_stopped_t{}, static_cast<_Receiver&&>(__rcvr));
}
};
} // namespace __receivers
@@ -140,17 +139,18 @@
{
if constexpr (__nothrow_callable<_Fun, _Args...>)
{
- ((_Fun&&)__fun)((_Args&&)__args...);
+ static_cast<_Fun&&>(__fun)(static_cast<_Args&&>(__args)...);
}
else
{
try
{
- ((_Fun&&)__fun)((_Args&&)__args...);
+ static_cast<_Fun&&>(__fun)(static_cast<_Args&&>(__args)...);
}
catch (...)
{
- set_error((_Receiver&&)__rcvr, std::current_exception());
+ set_error(static_cast<_Receiver&&>(__rcvr),
+ std::current_exception());
}
}
}
@@ -200,18 +200,6 @@
// completion_signatures
namespace __compl_sigs
{
-#if STDEXEC_NVHPC()
-template <class _Ty = __q<__types>, class... _Args>
-__types<__minvoke<_Ty, _Args...>> __test(set_value_t (*)(_Args...),
- set_value_t = {}, _Ty = {});
-template <class _Ty = __q<__types>, class _Error>
-__types<__minvoke<_Ty, _Error>> __test(set_error_t (*)(_Error),
- set_error_t = {}, _Ty = {});
-template <class _Ty = __q<__types>>
-__types<__minvoke<_Ty>> __test(set_stopped_t (*)(), set_stopped_t = {},
- _Ty = {});
-__types<> __test(__ignore, __ignore, __ignore = {});
-
template <class _Sig>
inline constexpr bool __is_compl_sig = false;
template <class... _Args>
@@ -220,58 +208,24 @@
inline constexpr bool __is_compl_sig<set_error_t(_Error)> = true;
template <>
inline constexpr bool __is_compl_sig<set_stopped_t()> = true;
+} // namespace __compl_sigs
-#else
-
-template <same_as<set_value_t> _Tag, class _Ty = __q<__types>, class... _Args>
-__types<__minvoke<_Ty, _Args...>> __test(_Tag (*)(_Args...));
-template <same_as<set_error_t> _Tag, class _Ty = __q<__types>, class _Error>
-__types<__minvoke<_Ty, _Error>> __test(_Tag (*)(_Error));
-template <same_as<set_stopped_t> _Tag, class _Ty = __q<__types>>
-__types<__minvoke<_Ty>> __test(_Tag (*)());
-template <class, class = void>
-__types<> __test(...);
-template <class _Tag, class _Ty = void, class... _Args>
-void __test(_Tag (*)(_Args...) noexcept) = delete;
-#endif
-
-#if STDEXEC_NVHPC()
template <class _Sig>
concept __completion_signature = __compl_sigs::__is_compl_sig<_Sig>;
-template <class _Sig, class _Tag, class _Ty = __q<__types>>
-using __signal_args_t =
- decltype(__compl_sigs::__test((_Sig*)nullptr, _Tag{}, _Ty{}));
-#else
-template <class _Sig>
-concept __completion_signature =
- __typename<decltype(__compl_sigs::__test((_Sig*)nullptr))>;
-
-template <class _Sig, class _Tag, class _Ty = __q<__types>>
-using __signal_args_t =
- decltype(__compl_sigs::__test<_Tag, _Ty>((_Sig*)nullptr));
-#endif
-} // namespace __compl_sigs
-
-using __compl_sigs::__completion_signature;
-
-template <__compl_sigs::__completion_signature... _Sigs>
+template <__completion_signature... _Sigs>
struct completion_signatures
-{
- // Uncomment this to see where completion_signatures is
- // erroneously getting instantiated:
- // static_assert(sizeof...(_Sigs) == -1u);
-};
+{};
namespace __compl_sigs
{
-template <class _TaggedTuple, __completion_tag _Tag, class... _Ts>
+template <class _TaggedTuple, class _Tag, class... _Ts>
auto __as_tagged_tuple_(_Tag (*)(_Ts...), _TaggedTuple*)
-> __mconst<__minvoke<_TaggedTuple, _Tag, _Ts...>>;
template <class _Sig, class _TaggedTuple>
using __as_tagged_tuple = decltype(__compl_sigs::__as_tagged_tuple_(
- (_Sig*)nullptr, (_TaggedTuple*)nullptr));
+ static_cast<_Sig*>(nullptr), static_cast<_TaggedTuple*>(nullptr)));
template <class _TaggedTuple, class _Variant, class... _Sigs>
auto __for_all_sigs_(completion_signatures<_Sigs...>*, _TaggedTuple*, _Variant*)
@@ -282,8 +236,9 @@
using __for_all_sigs = //
__minvoke< //
decltype(__compl_sigs::__for_all_sigs_( //
- (_Completions*)nullptr, (_TaggedTuple*)nullptr,
- (_Variant*)nullptr))>;
+ static_cast<_Completions*>(nullptr),
+ static_cast<_TaggedTuple*>(nullptr),
+ static_cast<_Variant*>(nullptr)))>;
template <class _Completions, class _TaggedTuple, class _Variant>
using __maybe_for_all_sigs =
@@ -337,12 +292,12 @@
template <class _Receiver, class _Tag, class... _Args>
requires nothrow_tag_invocable<_Tag, _Receiver, _Args...>
-__msuccess __try_completion(_Tag (*)(_Args...));
+auto __try_completion(_Tag (*)(_Args...)) -> __msuccess;
template <class _Receiver, class... _Sigs>
-auto __try_completions(completion_signatures<_Sigs...>*)
- -> decltype((__msuccess(), ...,
- stdexec::__try_completion<_Receiver>((_Sigs*)nullptr)));
+auto __try_completions(completion_signatures<_Sigs...>*) -> decltype((
+ __msuccess(), ...,
+ stdexec::__try_completion<_Receiver>(static_cast<_Sigs*>(nullptr))));
template <class _Sender, class _Env>
using __unrecognized_sender_error = //
@@ -354,6 +309,14 @@
__call_result_t<get_completion_signatures_t, _Sender, _Env>;
/////////////////////////////////////////////////////////////////////////////
+// early sender type-checking
+template <class _Sender>
+concept __well_formed_sender = //
+ !__detail::__non_dependent_sender<_Sender> ||
+ __valid_completion_signatures<
+ __completion_signatures_of_t<_Sender, empty_env>>;
+
+/////////////////////////////////////////////////////////////////////////////
// [execution.receivers]
struct receiver_t
{
@@ -401,8 +364,8 @@
{
struct __is_debug_env_t
{
- friend constexpr bool tag_invoke(forwarding_query_t,
- const __is_debug_env_t&) noexcept
+ friend constexpr auto tag_invoke(forwarding_query_t,
+ const __is_debug_env_t&) noexcept -> bool
{
return true;
}
@@ -482,7 +445,8 @@
template <same_as<get_env_t> _Tag>
STDEXEC_ATTRIBUTE((host, device))
- friend __debug_env_t<_Env> tag_invoke(_Tag, __debug_receiver) noexcept
+ friend auto tag_invoke(_Tag, __debug_receiver) noexcept
+ -> __debug_env_t<_Env>
{
STDEXEC_TERMINATE();
}
@@ -605,7 +569,8 @@
// static_assert(receiver_of<_Receiver, _Sigs>);
if constexpr (!same_as<_Operation, __debug_operation>)
{
- auto __op = connect((_Sender&&)__sndr, _Receiver{});
+ auto __op = connect(static_cast<_Sender&&>(__sndr),
+ _Receiver{});
start(__op);
}
}
@@ -629,7 +594,8 @@
// static_assert(receiver_of<_Receiver, _Sigs>);
if constexpr (!same_as<_Operation, __debug_operation>)
{
- auto __op = connect((_Sender&&)__sndr, _Receiver{});
+ auto __op = connect(static_cast<_Sender&&>(__sndr),
+ _Receiver{});
start(__op);
}
}
@@ -659,17 +625,19 @@
{
template <class _Domain, class _Sender, class _Env>
STDEXEC_ATTRIBUTE((always_inline))
- /*constexpr*/ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr,
- _Env&& __env) const noexcept
+ /*constexpr*/
+ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr,
+ _Env&& __env) const noexcept
{
if constexpr (__domain::__has_transform_env<_Domain, _Sender, _Env>)
{
- return __dom.transform_env((_Sender&&)__sndr, (_Env&&)__env);
+ return __dom.transform_env(static_cast<_Sender&&>(__sndr),
+ static_cast<_Env&&>(__env));
}
else
{
- return default_domain().transform_env((_Sender&&)__sndr,
- (_Env&&)__env);
+ return default_domain().transform_env(
+ static_cast<_Sender&&>(__sndr), static_cast<_Env&&>(__env));
}
}
};
@@ -678,18 +646,20 @@
{
template <class _Domain, class _Sender, class... _Env>
STDEXEC_ATTRIBUTE((always_inline))
- /*constexpr*/ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr,
- const _Env&... __env) const
+ /*constexpr*/
+ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr,
+ const _Env&... __env) const
{
if constexpr (__domain::__has_transform_sender<_Domain, _Sender,
_Env...>)
{
- return __dom.transform_sender((_Sender&&)__sndr, __env...);
+ return __dom.transform_sender(static_cast<_Sender&&>(__sndr),
+ __env...);
}
else
{
- return default_domain().transform_sender((_Sender&&)__sndr,
- __env...);
+ return default_domain().transform_sender(
+ static_cast<_Sender&&>(__sndr), __env...);
}
}
};
@@ -702,8 +672,9 @@
template <class _Self = __transform_sender, class _Domain, class _Sender,
class... _Env>
STDEXEC_ATTRIBUTE((always_inline))
- /*constexpr*/ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr,
- const _Env&... __env) const
+ /*constexpr*/
+ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr,
+ const _Env&... __env) const
{
using _Sender2 = __call_result_t<__transform_sender_1, _Domain, _Sender,
const _Env&...>;
@@ -711,16 +682,17 @@
// apply the transform recursively.
if constexpr (__decay_same_as<_Sender, _Sender2>)
{
- return __transform_sender_1()(__dom, (_Sender&&)__sndr, __env...);
+ return __transform_sender_1()(__dom, static_cast<_Sender&&>(__sndr),
+ __env...);
}
else
{
// We transformed the sender and got back a different sender.
// Transform that one too.
- return _Self()(
- __dom,
- __transform_sender_1()(__dom, (_Sender&&)__sndr, __env...),
- __env...);
+ return _Self()(__dom,
+ __transform_sender_1()(
+ __dom, static_cast<_Sender&&>(__sndr), __env...),
+ __env...);
}
}
};
@@ -733,14 +705,14 @@
// requested domain.
template <class _Domain, sender_expr _Sender, class _Env>
requires same_as<__early_domain_of_t<_Sender>, dependent_domain>
- /*constexpr*/ decltype(auto) operator()(_Domain __dom, _Sender&& __sndr,
- const _Env& __env) const
+ /*constexpr*/ auto operator()(_Domain __dom, _Sender&& __sndr,
+ const _Env& __env) const -> decltype(auto)
{
static_assert(__none_of<_Domain, dependent_domain>);
- return __transform_sender()(
- __dom,
- dependent_domain().transform_sender((_Sender&&)__sndr, __env),
- __env);
+ return __transform_sender()(__dom,
+ dependent_domain().transform_sender(
+ static_cast<_Sender&&>(__sndr), __env),
+ __env);
}
};
} // namespace __domain
@@ -766,20 +738,23 @@
template <sender_expr _Sender, class _Env>
requires same_as<__early_domain_of_t<_Sender>, dependent_domain>
-decltype(auto) dependent_domain::transform_sender(_Sender&& __sndr,
- const _Env& __env) const
+auto dependent_domain::transform_sender(_Sender&& __sndr,
+ const _Env& __env) const
+ -> decltype(auto)
{
// apply any algorithm-specific transformation to the environment
- const auto& __env2 = transform_env(*this, (_Sender&&)__sndr, __env);
+ const auto& __env2 = transform_env(*this, static_cast<_Sender&&>(__sndr),
+ __env);
// recursively transform the sender to determine the domain
- return __sexpr_apply((_Sender&&)__sndr,
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
[&]<class _Tag, class _Data, class... _Childs>(
_Tag, _Data&& __data, _Childs&&... __childs) {
// TODO: propagate meta-exceptions here:
auto __sndr2 = __make_sexpr<_Tag>(
- (_Data&&)__data, __domain::__transform_sender()(
- *this, (_Childs&&)__childs, __env2)...);
+ static_cast<_Data&&>(__data),
+ __domain::__transform_sender()(
+ *this, static_cast<_Childs&&>(__childs), __env2)...);
using _Sender2 = decltype(__sndr2);
auto __domain2 = __sexpr_apply(__sndr2, __domain::__common_domain_fn());
@@ -795,23 +770,9 @@
return __domain::__transform_sender()(__domain2, std::move(__sndr2),
__env);
}
- STDEXEC_UNREACHABLE();
});
}
-// A helper for use when building sender trees where each node must be
-// transformed.
-template <class _Domain, class _Env>
-auto __make_transformer(_Domain, const _Env& __env)
-{
- return [&]<class _Tag>(_Tag) {
- return [&]<class... _Args>(_Args&&... __args) -> decltype(auto) {
- return stdexec::transform_sender(_Domain(),
- _Tag()((_Args&&)__args...), __env);
- };
- };
-}
-
/////////////////////////////////////////////////////////////////////////////
template <class _Tag, class _Domain, class _Sender, class... _Args>
concept __has_implementation_for =
@@ -825,20 +786,22 @@
template <class _Domain, class _Tag, class _Sender, class... _Args>
requires __has_implementation_for<_Tag, _Domain, _Sender, _Args...>
STDEXEC_ATTRIBUTE((always_inline))
- /*constexpr*/ decltype(auto)
+ /*constexpr*/
+ decltype(auto)
operator()(_Domain __dom, _Tag, _Sender&& __sndr,
_Args&&... __args) const
{
if constexpr (__domain::__has_apply_sender<_Domain, _Tag, _Sender,
_Args...>)
{
- return __dom.apply_sender(_Tag(), (_Sender&&)__sndr,
- (_Args&&)__args...);
+ return __dom.apply_sender(_Tag(), static_cast<_Sender&&>(__sndr),
+ static_cast<_Args&&>(__args)...);
}
else
{
- return default_domain().apply_sender(_Tag(), (_Sender&&)__sndr,
- (_Args&&)__args...);
+ return default_domain().apply_sender(
+ _Tag(), static_cast<_Sender&&>(__sndr),
+ static_cast<_Args&&>(__args)...);
}
}
} apply_sender{};
@@ -884,27 +847,28 @@
{
// Computing the type of the transformed sender returned an error
// type. Propagate it.
- return (_TfxSender(*)()) nullptr;
+ return static_cast<_TfxSender (*)()>(nullptr);
}
else if constexpr (__with_tag_invoke<_Sender, _Env>)
{
using _Result = tag_invoke_result_t<get_completion_signatures_t,
_TfxSender, _Env>;
- return (_Result(*)()) nullptr;
+ return static_cast<_Result (*)()>(nullptr);
}
else if constexpr (__with_member_alias<_Sender, _Env>)
{
using _Result = __member_alias_t<_Sender, _Env>;
- return (_Result(*)()) nullptr;
+ return static_cast<_Result (*)()>(nullptr);
}
else if constexpr (__awaitable<_Sender, __env::__promise<_Env>>)
{
- using _Result = __await_result_t<_Sender, __env::__promise<_Env>>;
- return (completion_signatures<
- // set_value_t() or set_value_t(T)
- __minvoke<__remove<void, __qf<set_value_t>>, _Result>,
- set_error_t(std::exception_ptr),
- set_stopped_t()>(*)()) nullptr;
+ using _AwaitResult =
+ __await_result_t<_Sender, __env::__promise<_Env>>;
+ using _Result = completion_signatures<
+ // set_value_t() or set_value_t(T)
+ __minvoke<__remove<void, __qf<set_value_t>>, _AwaitResult>,
+ set_error_t(std::exception_ptr), set_stopped_t()>;
+ return static_cast<_Result (*)()>(nullptr);
}
else if constexpr (__is_debug_env<_Env>)
{
@@ -913,14 +877,14 @@
// is.
using _Completions [[maybe_unused]] =
tag_invoke_result_t<get_completion_signatures_t, _Sender, _Env>;
- return (__debug::__completion_signatures(*)()) nullptr;
+ return static_cast<__debug::__completion_signatures (*)()>(nullptr);
}
else
{
using _Result =
__mexception<_UNRECOGNIZED_SENDER_TYPE_<>,
_WITH_SENDER_<_Sender>, _WITH_ENVIRONMENT_<_Env>>;
- return (_Result(*)()) nullptr;
+ return static_cast<_Result (*)()>(nullptr);
}
}
@@ -969,7 +933,8 @@
sender<_Sender> && //
requires(_Sender&& __sndr, _Env&& __env) {
{
- get_completion_signatures((_Sender&&)__sndr, (_Env&&)__env)
+ get_completion_signatures(static_cast<_Sender&&>(__sndr),
+ static_cast<_Env&&>(__env))
} -> __valid_completion_signatures;
};
@@ -983,7 +948,8 @@
const _Env& __env) noexcept
{
using __completions_t = __completion_signatures_of_t<_Sender, _Env>;
- stdexec::__debug_sender<__completions_t>((_Sender&&)__sndr, __env);
+ stdexec::__debug_sender<__completions_t>(static_cast<_Sender&&>(__sndr),
+ __env);
return __completions_t{};
}
@@ -1286,10 +1252,10 @@
noexcept(nothrow_tag_invocable<schedule_t, _Scheduler>)
{
static_assert(sender<tag_invoke_result_t<schedule_t, _Scheduler>>);
- return tag_invoke(schedule_t{}, (_Scheduler&&)__sched);
+ return tag_invoke(schedule_t{}, static_cast<_Scheduler&&>(__sched));
}
- friend constexpr bool tag_invoke(forwarding_query_t, schedule_t)
+ friend constexpr auto tag_invoke(forwarding_query_t, schedule_t) -> bool
{
return false;
}
@@ -1315,7 +1281,7 @@
concept __has_schedule = //
requires(_Scheduler&& __sched) {
{
- schedule((_Scheduler&&)__sched)
+ schedule(static_cast<_Scheduler&&>(__sched))
} -> sender;
};
@@ -1325,7 +1291,7 @@
get_completion_scheduler_t<set_value_t>&& __tag) {
{
tag_invoke(std::move(__tag),
- get_env(schedule((_Scheduler&&)__sched)))
+ get_env(schedule(static_cast<_Scheduler&&>(__sched))))
} -> same_as<__decay_t<_Scheduler>>;
};
@@ -1359,9 +1325,7 @@
{
template <class _Op>
requires tag_invocable<start_t, _Op&>
- STDEXEC_ATTRIBUTE((always_inline)) //
- void
- operator()(_Op& __op) const noexcept
+ STDEXEC_ATTRIBUTE((always_inline)) void operator()(_Op& __op) const noexcept
{
static_assert(nothrow_tag_invocable<start_t, _Op&>);
(void)tag_invoke(start_t{}, __op);
@@ -1389,12 +1353,12 @@
{
struct __promise_base
{
- __coro::suspend_always initial_suspend() noexcept
+ auto initial_suspend() noexcept -> __coro::suspend_always
{
return {};
}
- [[noreturn]] __coro::suspend_always final_suspend() noexcept
+ [[noreturn]] auto final_suspend() noexcept -> __coro::suspend_always
{
std::terminate();
}
@@ -1472,25 +1436,26 @@
explicit __t(auto&, _Receiver& __rcvr) noexcept : __rcvr_(__rcvr) {}
- __coro::coroutine_handle<> unhandled_stopped() noexcept
+ auto unhandled_stopped() noexcept -> __coro::coroutine_handle<>
{
- set_stopped((_Receiver&&)__rcvr_);
+ set_stopped(static_cast<_Receiver&&>(__rcvr_));
// Returning noop_coroutine here causes the __connect_awaitable
// coroutine to never resume past the point where it co_await's
// the awaitable.
return __coro::noop_coroutine();
}
- stdexec::__t<__operation<_ReceiverId>> get_return_object() noexcept
+ auto get_return_object() noexcept
+ -> stdexec::__t<__operation<_ReceiverId>>
{
return stdexec::__t<__operation<_ReceiverId>>{
__coro::coroutine_handle<__t>::from_promise(*this)};
}
template <class _Awaitable>
- _Awaitable&& await_transform(_Awaitable&& __awaitable) noexcept
+ auto await_transform(_Awaitable&& __awaitable) noexcept -> _Awaitable&&
{
- return (_Awaitable&&)__awaitable;
+ return static_cast<_Awaitable&&>(__awaitable);
}
template <class _Awaitable>
@@ -1499,7 +1464,8 @@
noexcept(nothrow_tag_invocable<as_awaitable_t, _Awaitable, __t&>)
-> tag_invoke_result_t<as_awaitable_t, _Awaitable, __t&>
{
- return tag_invoke(as_awaitable, (_Awaitable&&)__awaitable, *this);
+ return tag_invoke(as_awaitable,
+ static_cast<_Awaitable&&>(__awaitable), *this);
}
// Pass through the get_env receiver query
@@ -1525,13 +1491,15 @@
template <class _Fun, class... _Ts>
static auto __co_call(_Fun __fun, _Ts&&... __as) noexcept
{
- auto __fn = [&, __fun]() noexcept { __fun((_Ts&&)__as...); };
+ auto __fn = [&, __fun]() noexcept {
+ __fun(static_cast<_Ts&&>(__as)...);
+ };
struct __awaiter
{
decltype(__fn) __fn_;
- static constexpr bool await_ready() noexcept
+ static constexpr auto await_ready() noexcept -> bool
{
return false;
}
@@ -1554,26 +1522,29 @@
#if STDEXEC_GCC() && (__GNUC__ > 11)
__attribute__((__used__))
#endif
- static __operation_t<_Receiver>
+ static auto
__co_impl(_Awaitable __awaitable, _Receiver __rcvr)
+ -> __operation_t<_Receiver>
{
using __result_t = __await_result_t<_Awaitable, __promise_t<_Receiver>>;
std::exception_ptr __eptr;
try
{
if constexpr (same_as<__result_t, void>)
- co_await (co_await (_Awaitable&&) __awaitable,
- __co_call(set_value, (_Receiver&&)__rcvr));
+ co_await (
+ co_await static_cast<_Awaitable&&>(__awaitable),
+ __co_call(set_value, static_cast<_Receiver&&>(__rcvr)));
else
- co_await __co_call(set_value, (_Receiver&&)__rcvr,
- co_await (_Awaitable&&) __awaitable);
+ co_await __co_call(
+ set_value, static_cast<_Receiver&&>(__rcvr),
+ co_await static_cast<_Awaitable&&>(__awaitable));
}
catch (...)
{
__eptr = std::current_exception();
}
- co_await __co_call(set_error, (_Receiver&&)__rcvr,
- (std::exception_ptr&&)__eptr);
+ co_await __co_call(set_error, static_cast<_Receiver&&>(__rcvr),
+ static_cast<std::exception_ptr&&>(__eptr));
}
template <receiver _Receiver, class _Awaitable>
@@ -1587,10 +1558,11 @@
public:
template <class _Receiver, __awaitable<__promise_t<_Receiver>> _Awaitable>
requires receiver_of<_Receiver, __completions_t<_Receiver, _Awaitable>>
- __operation_t<_Receiver> operator()(_Awaitable&& __awaitable,
- _Receiver __rcvr) const
+ auto operator()(_Awaitable&& __awaitable, _Receiver __rcvr) const
+ -> __operation_t<_Receiver>
{
- return __co_impl((_Awaitable&&)__awaitable, (_Receiver&&)__rcvr);
+ return __co_impl(static_cast<_Awaitable&&>(__awaitable),
+ static_cast<_Receiver&&>(__rcvr));
}
};
} // namespace __connect_awaitable_
@@ -1632,7 +1604,7 @@
struct connect_t
{
template <class _Sender, class _Env>
- static constexpr bool __check_signatures()
+ static constexpr auto __check_signatures() -> bool
{
if constexpr (sender_in<_Sender, _Env>)
{
@@ -1709,16 +1681,18 @@
tag_invoke_result_t<connect_t, _TfxSender, _Receiver>>,
"stdexec::connect(sender, receiver) must return a type that "
"satisfies the operation_state concept");
- return tag_invoke(
- connect_t{},
- transform_sender(__domain, (_Sender&&)__sndr, __env),
- (_Receiver&&)__rcvr);
+ return tag_invoke(connect_t{},
+ transform_sender(__domain,
+ static_cast<_Sender&&>(__sndr),
+ __env),
+ static_cast<_Receiver&&>(__rcvr));
}
else if constexpr (__connectable_with_co_await<_Sender, _Receiver>)
{
return __connect_awaitable( //
- transform_sender(__domain, (_Sender&&)__sndr, __env),
- (_Receiver&&)__rcvr);
+ transform_sender(__domain, static_cast<_Sender&&>(__sndr),
+ __env),
+ static_cast<_Receiver&&>(__rcvr));
}
else
{
@@ -1726,12 +1700,14 @@
// useful debugging information.
using __tag_invoke::tag_invoke;
tag_invoke(*this,
- transform_sender(__domain, (_Sender&&)__sndr, __env),
- (_Receiver&&)__rcvr);
+ transform_sender(__domain,
+ static_cast<_Sender&&>(__sndr), __env),
+ static_cast<_Receiver&&>(__rcvr));
}
}
- friend constexpr bool tag_invoke(forwarding_query_t, connect_t) noexcept
+ friend constexpr auto tag_invoke(forwarding_query_t, connect_t) noexcept
+ -> bool
{
return false;
}
@@ -1748,13 +1724,15 @@
sender_in<_Sender, env_of_t<_Receiver>> && //
__receiver_from<_Receiver, _Sender> && //
requires(_Sender&& __sndr, _Receiver&& __rcvr) {
- connect((_Sender&&)__sndr, (_Receiver&&)__rcvr);
+ connect(static_cast<_Sender&&>(__sndr),
+ static_cast<_Receiver&&>(__rcvr));
};
template <class _Tag, class... _Args>
-_Tag __tag_of_sig_(_Tag (*)(_Args...));
+auto __tag_of_sig_(_Tag (*)(_Args...)) -> _Tag;
template <class _Sig>
-using __tag_of_sig_t = decltype(stdexec::__tag_of_sig_((_Sig*)nullptr));
+using __tag_of_sig_t =
+ decltype(stdexec::__tag_of_sig_(static_cast<_Sig*>(nullptr)));
template <class _Sender, class _SetSig, class _Env = empty_env>
concept sender_of =
@@ -1788,12 +1766,13 @@
{
try
{
- __self.__result_->template emplace<1>((_Us&&)__us...);
+ __self.__result_->template emplace<1>(static_cast<_Us&&>(__us)...);
__self.__continuation_.resume();
}
catch (...)
{
- set_error((__receiver_base&&)__self, std::current_exception());
+ set_error(static_cast<__receiver_base&&>(__self),
+ std::current_exception());
}
}
@@ -1802,13 +1781,13 @@
_Error&& __err) noexcept
{
if constexpr (__decays_to<_Error, std::exception_ptr>)
- __self.__result_->template emplace<2>((_Error&&)__err);
+ __self.__result_->template emplace<2>(static_cast<_Error&&>(__err));
else if constexpr (__decays_to<_Error, std::error_code>)
__self.__result_->template emplace<2>(
std::make_exception_ptr(std::system_error(__err)));
else
__self.__result_->template emplace<2>(
- std::make_exception_ptr((_Error&&)__err));
+ std::make_exception_ptr(static_cast<_Error&&>(__err)));
__self.__continuation_.resume();
}
@@ -1837,8 +1816,8 @@
}
// Forward get_env query to the coroutine promise
- friend env_of_t<_Promise&> tag_invoke(get_env_t,
- const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> env_of_t<_Promise&>
{
auto __continuation =
__coro::coroutine_handle<_Promise>::from_address(
@@ -1852,7 +1831,7 @@
// by packaging the values into a tuple.
// See: https://github.com/cplusplus/sender-receiver/issues/182
template <std::size_t _Count>
-extern const __q<std::tuple> __as_single;
+extern const __q<__decayed_tuple> __as_single;
template <>
inline const __q<__midentity> __as_single<1>;
@@ -1876,12 +1855,12 @@
template <class _Value>
struct __sender_awaitable_base
{
- bool await_ready() const noexcept
+ [[nodiscard]] auto await_ready() const noexcept -> bool
{
return false;
}
- _Value await_resume()
+ auto await_resume() -> _Value
{
switch (__result_.index())
{
@@ -1890,7 +1869,7 @@
break;
case 1: // set_value
if constexpr (!std::is_void_v<_Value>)
- return (_Value&&)std::get<1>(__result_);
+ return static_cast<_Value&&>(std::get<1>(__result_));
else
return;
case 2: // set_error
@@ -1914,7 +1893,7 @@
{
__t(_Sender&& sndr, __coro::coroutine_handle<_Promise> __hcoro) //
noexcept(__nothrow_connectable<_Sender, __receiver>) :
- __op_state_(connect((_Sender&&)sndr,
+ __op_state_(connect(static_cast<_Sender&&>(sndr),
__receiver{{&this->__result_, __hcoro}}))
{}
@@ -1946,12 +1925,12 @@
struct __unspecified
{
- __unspecified get_return_object() noexcept;
- __unspecified initial_suspend() noexcept;
- __unspecified final_suspend() noexcept;
+ auto get_return_object() noexcept -> __unspecified;
+ auto initial_suspend() noexcept -> __unspecified;
+ auto final_suspend() noexcept -> __unspecified;
void unhandled_exception() noexcept;
void return_void() noexcept;
- __coro::coroutine_handle<> unhandled_stopped() noexcept;
+ auto unhandled_stopped() noexcept -> __coro::coroutine_handle<>;
};
struct as_awaitable_t
@@ -1965,10 +1944,12 @@
constexpr bool _Nothrow =
nothrow_tag_invocable<as_awaitable_t, _Tp, _Promise&>;
return static_cast<_Result (*)() noexcept(_Nothrow)>(nullptr);
+ // NOLINTNEXTLINE(bugprone-branch-clone)
}
else if constexpr (__awaitable<_Tp, __unspecified>)
{ // NOT __awaitable<_Tp, _Promise> !!
- return static_cast < _Tp && (*)() noexcept > (nullptr);
+ using _Result = _Tp&&;
+ return static_cast<_Result (*)() noexcept>(nullptr);
}
else if constexpr (__awaitable_sender<_Tp, _Promise>)
{
@@ -1979,7 +1960,8 @@
}
else
{
- return static_cast < _Tp && (*)() noexcept > (nullptr);
+ using _Result = _Tp&&;
+ return static_cast<_Result (*)() noexcept>(nullptr);
}
}
template <class _Tp, class _Promise>
@@ -1994,21 +1976,23 @@
{
using _Result = tag_invoke_result_t<as_awaitable_t, _Tp, _Promise&>;
static_assert(__awaitable<_Result, _Promise>);
- return tag_invoke(*this, (_Tp&&)__t, __promise);
+ return tag_invoke(*this, static_cast<_Tp&&>(__t), __promise);
+ // NOLINTNEXTLINE(bugprone-branch-clone)
}
else if constexpr (__awaitable<_Tp, __unspecified>)
{ // NOT __awaitable<_Tp, _Promise> !!
- return (_Tp&&)__t;
+ return static_cast<_Tp&&>(__t);
}
else if constexpr (__awaitable_sender<_Tp, _Promise>)
{
auto __hcoro =
__coro::coroutine_handle<_Promise>::from_promise(__promise);
- return __sender_awaitable_t<_Promise, _Tp>{(_Tp&&)__t, __hcoro};
+ return __sender_awaitable_t<_Promise, _Tp>{static_cast<_Tp&&>(__t),
+ __hcoro};
}
else
{
- return (_Tp&&)__t;
+ return static_cast<_Tp&&>(__t);
}
}
};
@@ -2053,12 +2037,13 @@
// exception and terminate() is called.
}
- __coro::coroutine_handle<> handle() const noexcept
+ [[nodiscard]] auto handle() const noexcept -> __coro::coroutine_handle<>
{
return __coro_;
}
- __coro::coroutine_handle<> unhandled_stopped() const noexcept
+ [[nodiscard]] auto unhandled_stopped() const noexcept
+ -> __coro::coroutine_handle<>
{
return __stopped_callback_(__coro_.address());
}
@@ -2080,13 +2065,14 @@
__continuation_{__coro}
{}
- __coro::coroutine_handle<_Promise> handle() const noexcept
+ auto handle() const noexcept -> __coro::coroutine_handle<_Promise>
{
return __coro::coroutine_handle<_Promise>::from_address(
__continuation_.handle().address());
}
- __coro::coroutine_handle<> unhandled_stopped() const noexcept
+ [[nodiscard]] auto unhandled_stopped() const noexcept
+ -> __coro::coroutine_handle<>
{
return __continuation_.unhandled_stopped();
}
@@ -2110,12 +2096,12 @@
__continuation_ = __continuation;
}
- __continuation_handle<> continuation() const noexcept
+ [[nodiscard]] auto continuation() const noexcept -> __continuation_handle<>
{
return __continuation_;
}
- __coro::coroutine_handle<> unhandled_stopped() noexcept
+ auto unhandled_stopped() noexcept -> __coro::coroutine_handle<>
{
return __continuation_.unhandled_stopped();
}
@@ -2132,7 +2118,8 @@
-> __call_result_t<as_awaitable_t, _Value, _Promise&>
{
static_assert(derived_from<_Promise, with_awaitable_senders>);
- return as_awaitable((_Value&&)__val, static_cast<_Promise&>(*this));
+ return as_awaitable(static_cast<_Value&&>(__val),
+ static_cast<_Promise&>(*this));
}
};
} // namespace __with_awaitable_senders
@@ -2146,7 +2133,7 @@
inline constexpr auto __ref = []<class _Ty>(_Ty& __ty) noexcept {
return [__ty = &__ty]() noexcept -> decltype(auto) { return (*__ty); };
};
-}
+} // namespace
template <class _Ty>
using __ref_t = decltype(__ref(__declval<_Ty&>()));
@@ -2173,7 +2160,8 @@
friend void tag_invoke(_Tag __tag, __receiver&& __self,
_As&&... __as) noexcept
{
- __tag((_Receiver&&)__self.__opref_().__rcvr_, (_As&&)__as...);
+ __tag(static_cast<_Receiver&&>(__self.__opref_().__rcvr_),
+ static_cast<_As&&>(__as)...);
__self.__delete_op();
}
@@ -2212,12 +2200,14 @@
using _Receiver = stdexec::__t<_ReceiverId>;
using __receiver_t = __receiver<__ref_t<__operation>>;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Receiver __rcvr_;
connect_result_t<_Sender, __receiver_t> __op_state_;
__operation(_Sender&& __sndr, _Receiver __rcvr) :
- __rcvr_((_Receiver&&)__rcvr),
- __op_state_(connect((_Sender&&)__sndr, __receiver_t{__ref(*this)}))
+ __rcvr_(static_cast<_Receiver&&>(__rcvr)),
+ __op_state_(
+ connect(static_cast<_Sender&&>(__sndr), __receiver_t{__ref(*this)}))
{}
};
@@ -2240,7 +2230,8 @@
try
{
std::allocator_traits<_OpAlloc>::construct(
- __op_alloc, __op, (_Sender&&)__sndr, (_Receiver&&)__rcvr);
+ __op_alloc, __op, static_cast<_Sender&&>(__sndr),
+ static_cast<_Receiver&&>(__rcvr));
start(__op->__op_state_);
}
catch (...)
@@ -2253,7 +2244,8 @@
else
{
start((new __operation<__id<_Sender>, __id<_Receiver>>{
- (_Sender&&)__sndr, (_Receiver&&)__rcvr})
+ static_cast<_Sender&&>(__sndr),
+ static_cast<_Receiver&&>(__rcvr)})
->__op_state_);
}
}
@@ -2280,13 +2272,13 @@
return __make_sexpr<_Tag>();
}
- friend forward_progress_guarantee
- tag_invoke(get_forward_progress_guarantee_t, __scheduler) noexcept
+ friend auto tag_invoke(get_forward_progress_guarantee_t,
+ __scheduler) noexcept -> forward_progress_guarantee
{
return forward_progress_guarantee::weakly_parallel;
}
- bool operator==(const __scheduler&) const noexcept = default;
+ auto operator==(const __scheduler&) const noexcept -> bool = default;
};
} // namespace __inln
@@ -2309,7 +2301,7 @@
static constexpr auto start = //
[]<class _Receiver>(__ignore, _Receiver& __rcvr) noexcept -> void {
- set_value((_Receiver&&)__rcvr);
+ set_value(static_cast<_Receiver&&>(__rcvr));
};
};
@@ -2326,7 +2318,8 @@
{
using receiver_concept = receiver_t;
using __id = __detached_receiver;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Env __env_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Env __env_;
template <same_as<set_value_t> _Tag, class... _As>
friend void tag_invoke(_Tag, __t&&, _As&&...) noexcept
@@ -2342,7 +2335,8 @@
friend void tag_invoke(_Tag, __t&&) noexcept
{}
- friend const _Env& tag_invoke(get_env_t, const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> const _Env&
{
// BUGBUG NOT TO SPEC
return __self.__env_;
@@ -2360,7 +2354,7 @@
void operator()(_Sender&& __sndr) const
{
auto __domain = __get_early_domain(__sndr);
- stdexec::apply_sender(__domain, *this, (_Sender&&)__sndr);
+ stdexec::apply_sender(__domain, *this, static_cast<_Sender&&>(__sndr));
}
template <class _Env, sender_in<_Env> _Sender>
@@ -2369,8 +2363,8 @@
void operator()(_Sender&& __sndr, _Env&& __env) const
{
auto __domain = __get_late_domain(__sndr, __env);
- stdexec::apply_sender(__domain, *this, (_Sender&&)__sndr,
- (_Env&&)__env);
+ stdexec::apply_sender(__domain, *this, static_cast<_Sender&&>(__sndr),
+ static_cast<_Env&&>(__env));
}
using _Sender = __0;
@@ -2385,7 +2379,8 @@
requires sender_to<_Sender, __detached_receiver_t<_Env>>
void apply_sender(_Sender&& __sndr, _Env&& __env = {}) const
{
- __submit((_Sender&&)__sndr, __detached_receiver_t<_Env>{(_Env&&)__env});
+ __submit(static_cast<_Sender&&>(__sndr),
+ __detached_receiver_t<_Env>{static_cast<_Env&&>(__env)});
}
};
} // namespace __start_detached
@@ -2429,7 +2424,7 @@
auto operator()(_Ts&&... __ts) const
noexcept((__nothrow_decay_copyable<_Ts> && ...))
{
- return __make_sexpr<just_t>(__tuple{(_Ts&&)__ts...});
+ return __make_sexpr<just_t>(__tuple{static_cast<_Ts&&>(__ts)...});
}
};
@@ -2442,7 +2437,8 @@
auto operator()(_Error&& __err) const
noexcept(__nothrow_decay_copyable<_Error>)
{
- return __make_sexpr<just_error_t>(__tuple{(_Error&&)__err});
+ return __make_sexpr<just_error_t>(
+ __tuple{static_cast<_Error&&>(__err)});
}
};
@@ -2498,7 +2494,8 @@
}
catch (...)
{
- set_error((__as_receiver&&)__rcvr, std::exception_ptr());
+ set_error(static_cast<__as_receiver&&>(__rcvr),
+ std::exception_ptr());
}
}
@@ -2513,7 +2510,8 @@
friend void tag_invoke(_Tag, __as_receiver&&) noexcept
{}
- friend empty_env tag_invoke(get_env_t, const __as_receiver&) noexcept
+ friend auto tag_invoke(get_env_t, const __as_receiver&) noexcept
+ -> empty_env
{
return {};
}
@@ -2528,14 +2526,15 @@
// Look for a legacy customization
if constexpr (tag_invocable<execute_t, _Scheduler, _Fun>)
{
- tag_invoke(execute_t{}, (_Scheduler&&)__sched, (_Fun&&)__fun);
+ tag_invoke(execute_t{}, static_cast<_Scheduler&&>(__sched),
+ static_cast<_Fun&&>(__fun));
}
else
{
auto __domain = query_or(get_domain, __sched, default_domain());
stdexec::apply_sender(__domain, *this,
- schedule((_Scheduler&&)__sched),
- (_Fun&&)__fun);
+ schedule(static_cast<_Scheduler&&>(__sched)),
+ static_cast<_Fun&&>(__fun));
}
}
@@ -2543,7 +2542,8 @@
requires __callable<_Fun&> && move_constructible<_Fun>
void apply_sender(_Sender&& __sndr, _Fun __fun) const noexcept(false)
{
- __submit((_Sender&&)__sndr, __as_receiver<_Fun>{(_Fun&&)__fun});
+ __submit(static_cast<_Sender&&>(__sndr),
+ __as_receiver<_Fun>{static_cast<_Fun&&>(__fun)});
}
};
} // namespace __execute_
@@ -2556,7 +2556,7 @@
{
template <__class _Dp>
struct sender_adaptor_closure;
-}
+} // namespace __closure
using __closure::sender_adaptor_closure;
@@ -2577,27 +2577,30 @@
template <class _T0, class _T1>
struct __compose : sender_adaptor_closure<__compose<_T0, _T1>>
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _T0 __t0_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _T1 __t1_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T0 __t0_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _T1 __t1_;
template <sender _Sender>
requires __callable<_T0, _Sender> &&
__callable<_T1, __call_result_t<_T0, _Sender>>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__call_result_t<_T1, __call_result_t<_T0, _Sender>>
operator()(_Sender&& __sndr) &&
{
- return ((_T1&&)__t1_)(((_T0&&)__t0_)((_Sender&&)__sndr));
+ return static_cast<_T1&&>(__t1_)(
+ static_cast<_T0&&>(__t0_)(static_cast<_Sender&&>(__sndr)));
}
template <sender _Sender>
requires __callable<const _T0&, _Sender> &&
__callable<const _T1&, __call_result_t<const _T0&, _Sender>>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__call_result_t<_T1, __call_result_t<_T0, _Sender>>
operator()(_Sender&& __sndr) const&
{
- return __t1_(__t0_((_Sender&&)__sndr));
+ return __t1_(__t0_(static_cast<_Sender&&>(__sndr)));
}
};
@@ -2606,52 +2609,54 @@
{};
template <sender _Sender, __sender_adaptor_closure_for<_Sender> _Closure>
-STDEXEC_ATTRIBUTE((always_inline)) //
+STDEXEC_ATTRIBUTE((always_inline))
__call_result_t<_Closure, _Sender> operator|(_Sender&& __sndr,
_Closure&& __clsur)
{
- return ((_Closure&&)__clsur)((_Sender&&)__sndr);
+ return static_cast<_Closure&&>(__clsur)(static_cast<_Sender&&>(__sndr));
}
template <__sender_adaptor_closure _T0, __sender_adaptor_closure _T1>
-STDEXEC_ATTRIBUTE((always_inline)) //
+STDEXEC_ATTRIBUTE((always_inline))
__compose<__decay_t<_T0>, __decay_t<_T1>> operator|(_T0&& __t0, _T1&& __t1)
{
- return {{}, (_T0&&)__t0, (_T1&&)__t1};
+ return {{}, static_cast<_T0&&>(__t0), static_cast<_T1&&>(__t1)};
}
template <class _Fun, class... _As>
struct __binder_back : sender_adaptor_closure<__binder_back<_Fun, _As...>>
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fun __fun_;
std::tuple<_As...> __as_;
template <sender _Sender>
requires __callable<_Fun, _Sender, _As...>
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
- __call_result_t<_Fun, _Sender, _As...>
+ STDEXEC_ATTRIBUTE((host, device,
+ always_inline)) __call_result_t<_Fun, _Sender, _As...>
operator()(_Sender&& __sndr) && noexcept(
__nothrow_callable<_Fun, _Sender, _As...>)
{
return __apply(
[&__sndr,
this](_As&... __as) -> __call_result_t<_Fun, _Sender, _As...> {
- return ((_Fun&&)__fun_)((_Sender&&)__sndr, (_As&&)__as...);
+ return static_cast<_Fun&&>(__fun_)(static_cast<_Sender&&>(__sndr),
+ static_cast<_As&&>(__as)...);
},
__as_);
}
template <sender _Sender>
requires __callable<const _Fun&, _Sender, const _As&...>
- STDEXEC_ATTRIBUTE((host, device))
- __call_result_t<const _Fun&, _Sender, const _As&...>
+ STDEXEC_ATTRIBUTE((host, device)) auto
operator()(_Sender&& __sndr) const& //
noexcept(__nothrow_callable<const _Fun&, _Sender, const _As&...>)
+ -> __call_result_t<const _Fun&, _Sender, const _As&...>
{
return __apply(
[&__sndr, this](const _As&... __as)
-> __call_result_t<const _Fun&, _Sender, const _As&...> {
- return __fun_((_Sender&&)__sndr, __as...);
+ return __fun_(static_cast<_Sender&&>(__sndr), __as...);
},
__as_);
}
@@ -2662,17 +2667,21 @@
namespace __adaptors
{
+STDEXEC_PRAGMA_PUSH()
+STDEXEC_PRAGMA_IGNORE_GNU("-Wold-style-cast")
+
// A derived-to-base cast that works even when the base is not
// accessible from derived.
template <class _Tp, class _Up>
STDEXEC_ATTRIBUTE((host, device))
-__copy_cvref_t<_Up&&, _Tp> __c_cast(_Up&& u) noexcept
+auto __c_cast(_Up&& u) noexcept -> __copy_cvref_t<_Up&&, _Tp>
requires __decays_to<_Tp, _Tp>
{
static_assert(std::is_reference_v<__copy_cvref_t<_Up&&, _Tp>>);
static_assert(STDEXEC_IS_BASE_OF(_Tp, __decay_t<_Up>));
- return (__copy_cvref_t<_Up&&, _Tp>)(_Up&&)u;
+ return (__copy_cvref_t<_Up&&, _Tp>)static_cast<_Up&&>(u);
}
+STDEXEC_PRAGMA_POP()
namespace __no
{
@@ -2688,7 +2697,7 @@
void tag_invoke(_Tag, __receiver, std::exception_ptr) noexcept;
template <same_as<set_stopped_t> _Tag>
void tag_invoke(_Tag, __receiver) noexcept;
-empty_env tag_invoke(get_env_t, __receiver) noexcept;
+auto tag_invoke(get_env_t, __receiver) noexcept -> empty_env;
} // namespace __no
using __not_a_receiver = __no::__receiver;
@@ -2698,29 +2707,33 @@
{
template <class _T1>
requires constructible_from<_Base, _T1>
- explicit __adaptor_base(_T1&& __base) : __base_((_T1&&)__base)
+ explicit __adaptor_base(_T1&& __base) : __base_(static_cast<_T1&&>(__base))
{}
private:
- STDEXEC_ATTRIBUTE((no_unique_address)) _Base __base_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Base __base_;
protected:
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
+ STDEXEC_ATTRIBUTE((host, device, always_inline))
+
_Base& base() & noexcept
{
return __base_;
}
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
+ STDEXEC_ATTRIBUTE((host, device, always_inline))
+
const _Base& base() const& noexcept
{
return __base_;
}
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
+ STDEXEC_ATTRIBUTE((host, device, always_inline))
+
_Base&& base() && noexcept
{
- return (_Base&&)__base_;
+ return static_cast<_Base&&>(__base_);
}
};
@@ -2732,30 +2745,33 @@
// don't shadow type aliases of the same name in base classes. :-O
// On mingw gcc, 'bool(type::existing_member_function)' evaluates to true,
// but 'int(type::existing_member_function)' is an error (as desired).
-#define _DISPATCH_MEMBER(_TAG) \
+#define STDEXEC_DISPATCH_MEMBER(_TAG) \
template <class _Self, class... _Ts> \
STDEXEC_ATTRIBUTE((host, device, always_inline)) \
static auto __call_##_TAG(_Self&& __self, _Ts&&... __ts) noexcept \
- -> decltype(((_Self&&)__self)._TAG((_Ts&&)__ts...)) \
+ -> decltype((static_cast<_Self&&>(__self)) \
+ ._TAG(static_cast<_Ts&&>(__ts)...)) \
{ \
- static_assert(noexcept(((_Self&&)__self)._TAG((_Ts&&)__ts...))); \
- return ((_Self&&)__self)._TAG((_Ts&&)__ts...); \
+ static_assert(noexcept((static_cast<_Self&&>(__self)) \
+ ._TAG(static_cast<_Ts&&>(__ts)...))); \
+ return static_cast<_Self&&>(__self)._TAG(static_cast<_Ts&&>(__ts)...); \
} /**/
-#define _CALL_MEMBER(_TAG, ...) __call_##_TAG(__VA_ARGS__)
+#define STDEXEC_CALL_MEMBER(_TAG, ...) __call_##_TAG(__VA_ARGS__)
#if STDEXEC_CLANG()
// Only clang gets this right.
-#define _MISSING_MEMBER(_Dp, _TAG) requires { typename _Dp::_TAG; }
-#define _DEFINE_MEMBER(_TAG) _DISPATCH_MEMBER(_TAG) using _TAG = void
+#define STDEXEC_MISSING_MEMBER(_Dp, _TAG) requires { typename _Dp::_TAG; }
+#define STDEXEC_DEFINE_MEMBER(_TAG) \
+ STDEXEC_DISPATCH_MEMBER(_TAG) using _TAG = void
#else
-#define _MISSING_MEMBER(_Dp, _TAG) (__missing_##_TAG<_Dp>())
-#define _DEFINE_MEMBER(_TAG) \
+#define STDEXEC_MISSING_MEMBER(_Dp, _TAG) (__missing_##_TAG<_Dp>())
+#define STDEXEC_DEFINE_MEMBER(_TAG) \
template <class _Dp> \
static constexpr bool __missing_##_TAG() noexcept \
{ \
return requires { requires bool(int(_Dp::_TAG)); }; \
} \
- _DISPATCH_MEMBER(_TAG) \
+ STDEXEC_DISPATCH_MEMBER(_TAG) \
static constexpr int _TAG = 1 /**/
#endif
@@ -2763,10 +2779,10 @@
struct receiver_adaptor : __adaptor_base<_Base>, receiver_t
{
friend _Derived;
- _DEFINE_MEMBER(set_value);
- _DEFINE_MEMBER(set_error);
- _DEFINE_MEMBER(set_stopped);
- _DEFINE_MEMBER(get_env);
+ STDEXEC_DEFINE_MEMBER(set_value);
+ STDEXEC_DEFINE_MEMBER(set_error);
+ STDEXEC_DEFINE_MEMBER(set_stopped);
+ STDEXEC_DEFINE_MEMBER(get_env);
static constexpr bool __has_base = !derived_from<_Base, __no::__nope>;
@@ -2782,15 +2798,16 @@
template <class _Dp>
STDEXEC_ATTRIBUTE((host, device))
- static __base_t<_Dp> __get_base(_Dp&& __self) noexcept
+ static auto __get_base(_Dp&& __self) noexcept -> __base_t<_Dp>
{
if constexpr (__has_base)
{
- return __c_cast<receiver_adaptor>((_Dp&&)__self).base();
+ return __c_cast<receiver_adaptor>(static_cast<_Dp&&>(__self))
+ .base();
}
else
{
- return ((_Dp&&)__self).base();
+ return static_cast<_Dp&&>(__self).base();
}
}
@@ -2800,87 +2817,100 @@
_As&&... __as) noexcept //
-> __msecond< //
__if_c<same_as<set_value_t, _SetValue>>,
- decltype(_CALL_MEMBER(set_value, (_Derived&&)__self,
- (_As&&)__as...))>
+ decltype(STDEXEC_CALL_MEMBER(set_value,
+ static_cast<_Derived&&>(__self),
+ static_cast<_As&&>(__as)...))>
{
static_assert(noexcept(
- _CALL_MEMBER(set_value, (_Derived&&)__self, (_As&&)__as...)));
- _CALL_MEMBER(set_value, (_Derived&&)__self, (_As&&)__as...);
+ STDEXEC_CALL_MEMBER(set_value, static_cast<_Derived&&>(__self),
+ static_cast<_As&&>(__as)...)));
+ STDEXEC_CALL_MEMBER(set_value, static_cast<_Derived&&>(__self),
+ static_cast<_As&&>(__as)...);
}
template <same_as<set_value_t> _SetValue, class _Dp = _Derived,
class... _As>
- requires _MISSING_MEMBER
+ requires STDEXEC_MISSING_MEMBER
(_Dp, set_value) &&
- tag_invocable<_SetValue, __base_t<_Dp>, _As...> STDEXEC_ATTRIBUTE(
- (host, device, always_inline)) //
- friend void tag_invoke(_SetValue, _Derived&& __self,
- _As&&... __as) noexcept
+ tag_invocable<_SetValue, __base_t<_Dp>, _As...> STDEXEC_ATTRIBUTE((
+ host, device,
+ always_inline)) friend void tag_invoke(_SetValue, _Derived&& __self,
+ _As&&... __as) noexcept
{
- stdexec::set_value(__get_base((_Dp&&)__self), (_As&&)__as...);
+ stdexec::set_value(__get_base(static_cast<_Dp&&>(__self)),
+ static_cast<_As&&>(__as)...);
}
template <same_as<set_error_t> _SetError, class _Error>
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
+ STDEXEC_ATTRIBUTE((host, device, always_inline))
friend auto tag_invoke(_SetError, _Derived&& __self,
- _Error&& __err) noexcept //
- -> __msecond< //
+ _Error&& __err) noexcept //
+ -> __msecond< //
__if_c<same_as<set_error_t, _SetError>>,
- decltype(_CALL_MEMBER(set_error, (_Derived&&)__self,
- (_Error&&)__err))>
+ decltype(STDEXEC_CALL_MEMBER(set_error,
+ static_cast<_Derived&&>(__self),
+ static_cast<_Error&&>(__err)))>
{
static_assert(noexcept(
- _CALL_MEMBER(set_error, (_Derived&&)__self, (_Error&&)__err)));
- _CALL_MEMBER(set_error, (_Derived&&)__self, (_Error&&)__err);
+ STDEXEC_CALL_MEMBER(set_error, static_cast<_Derived&&>(__self),
+ static_cast<_Error&&>(__err))));
+ STDEXEC_CALL_MEMBER(set_error, static_cast<_Derived&&>(__self),
+ static_cast<_Error&&>(__err));
}
template <same_as<set_error_t> _SetError, class _Error,
class _Dp = _Derived>
- requires _MISSING_MEMBER
+ requires STDEXEC_MISSING_MEMBER
(_Dp, set_error) &&
- tag_invocable<_SetError, __base_t<_Dp>, _Error> STDEXEC_ATTRIBUTE(
- (host, device, always_inline)) //
- friend void tag_invoke(_SetError, _Derived&& __self,
- _Error&& __err) noexcept
+ tag_invocable<_SetError, __base_t<_Dp>, _Error> STDEXEC_ATTRIBUTE((
+ host, device,
+ always_inline)) friend void tag_invoke(_SetError, _Derived&& __self,
+ _Error&& __err) noexcept
{
- stdexec::set_error(__get_base((_Derived&&)__self), (_Error&&)__err);
+ stdexec::set_error(__get_base(static_cast<_Derived&&>(__self)),
+ static_cast<_Error&&>(__err));
}
template <same_as<set_stopped_t> _SetStopped, class _Dp = _Derived>
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
+ STDEXEC_ATTRIBUTE((host, device, always_inline))
friend auto tag_invoke(_SetStopped, _Derived&& __self) noexcept //
-> __msecond< //
__if_c<same_as<set_stopped_t, _SetStopped>>,
- decltype(_CALL_MEMBER(set_stopped, (_Dp&&)__self))>
+ decltype(STDEXEC_CALL_MEMBER(set_stopped,
+ static_cast<_Dp&&>(__self)))>
{
- static_assert(noexcept(_CALL_MEMBER(set_stopped, (_Derived&&)__self)));
- _CALL_MEMBER(set_stopped, (_Derived&&)__self);
+ static_assert(noexcept(
+ STDEXEC_CALL_MEMBER(set_stopped, static_cast<_Derived&&>(__self))));
+ STDEXEC_CALL_MEMBER(set_stopped, static_cast<_Derived&&>(__self));
}
template <same_as<set_stopped_t> _SetStopped, class _Dp = _Derived>
- requires _MISSING_MEMBER
+ requires STDEXEC_MISSING_MEMBER
(_Dp, set_stopped) &&
tag_invocable<_SetStopped, __base_t<_Dp>> STDEXEC_ATTRIBUTE(
- (host, device, always_inline)) //
- friend void tag_invoke(_SetStopped, _Derived&& __self) noexcept
+ (host, device,
+ always_inline)) friend void tag_invoke(_SetStopped,
+ _Derived&& __self) noexcept
{
- stdexec::set_stopped(__get_base((_Derived&&)__self));
+ stdexec::set_stopped(__get_base(static_cast<_Derived&&>(__self)));
}
// Pass through the get_env receiver query
template <same_as<get_env_t> _GetEnv, class _Dp = _Derived>
- STDEXEC_ATTRIBUTE((host, device, always_inline)) //
+ STDEXEC_ATTRIBUTE((host, device, always_inline))
friend auto tag_invoke(_GetEnv, const _Derived& __self) noexcept
- -> decltype(_CALL_MEMBER(get_env, (const _Dp&)__self))
+ -> decltype(STDEXEC_CALL_MEMBER(get_env,
+ static_cast<const _Dp&>(__self)))
{
- static_assert(noexcept(_CALL_MEMBER(get_env, __self)));
- return _CALL_MEMBER(get_env, __self);
+ static_assert(noexcept(STDEXEC_CALL_MEMBER(get_env, __self)));
+ return STDEXEC_CALL_MEMBER(get_env, __self);
}
template <same_as<get_env_t> _GetEnv, class _Dp = _Derived>
- requires _MISSING_MEMBER
- (_Dp, get_env) STDEXEC_ATTRIBUTE((host, device, always_inline)) //
- friend auto tag_invoke(_GetEnv, const _Derived& __self) noexcept
+ requires STDEXEC_MISSING_MEMBER
+ (_Dp, get_env)
+ STDEXEC_ATTRIBUTE((host, device, always_inline)) friend auto tag_invoke(
+ _GetEnv, const _Derived& __self) noexcept
-> env_of_t<__base_t<const _Dp&>>
{
return stdexec::get_env(__get_base(__self));
@@ -2911,25 +2941,28 @@
{
if constexpr (same_as<void, __invoke_result_t<_Fun, _As...>>)
{
- __invoke((_Fun&&)__fun, (_As&&)__as...);
- set_value((_Receiver&&)__rcvr);
+ __invoke(static_cast<_Fun&&>(__fun), static_cast<_As&&>(__as)...);
+ set_value(static_cast<_Receiver&&>(__rcvr));
}
else
{
- set_value((_Receiver&&)__rcvr,
- __invoke((_Fun&&)__fun, (_As&&)__as...));
+ set_value(static_cast<_Receiver&&>(__rcvr),
+ __invoke(static_cast<_Fun&&>(__fun),
+ static_cast<_As&&>(__as)...));
}
}
else
{
try
{
- stdexec::__set_value_invoke<true>((_Receiver&&)__rcvr,
- (_Fun&&)__fun, (_As&&)__as...);
+ stdexec::__set_value_invoke<true>(static_cast<_Receiver&&>(__rcvr),
+ static_cast<_Fun&&>(__fun),
+ static_cast<_As&&>(__as)...);
}
catch (...)
{
- set_error((_Receiver&&)__rcvr, std::current_exception());
+ set_error(static_cast<_Receiver&&>(__rcvr),
+ std::current_exception());
}
}
}
@@ -2998,18 +3031,20 @@
struct then_t
{
template <sender _Sender, __movable_value _Fun>
- auto operator()(_Sender&& __sndr, _Fun __fun) const
+ auto operator()(_Sender&& __sndr, _Fun __fun) const -> __well_formed_sender
+ auto
{
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
- __domain, __make_sexpr<then_t>((_Fun&&)__fun, (_Sender&&)__sndr));
+ __domain, __make_sexpr<then_t>(static_cast<_Fun&&>(__fun),
+ static_cast<_Sender&&>(__sndr)));
}
template <__movable_value _Fun>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__binder_back<then_t, _Fun> operator()(_Fun __fun) const
{
- return {{}, {}, {(_Fun&&)__fun}};
+ return {{}, {}, {static_cast<_Fun&&>(__fun)}};
}
using _Sender = __1;
@@ -3039,11 +3074,11 @@
if constexpr (std::same_as<_Tag, set_value_t>)
{
stdexec::__set_value_invoke(std::move(__rcvr), std::move(__state),
- (_Args&&)__args...);
+ static_cast<_Args&&>(__args)...);
}
else
{
- _Tag()(std::move(__rcvr), (_Args&&)__args...);
+ _Tag()(std::move(__rcvr), static_cast<_Args&&>(__args)...);
}
};
};
@@ -3082,19 +3117,21 @@
struct upon_error_t
{
template <sender _Sender, __movable_value _Fun>
- auto operator()(_Sender&& __sndr, _Fun __fun) const
+ auto operator()(_Sender&& __sndr, _Fun __fun) const -> __well_formed_sender
+ auto
{
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
__domain,
- __make_sexpr<upon_error_t>((_Fun&&)__fun, (_Sender&&)__sndr));
+ __make_sexpr<upon_error_t>(static_cast<_Fun&&>(__fun),
+ static_cast<_Sender&&>(__sndr)));
}
template <__movable_value _Fun>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__binder_back<upon_error_t, _Fun> operator()(_Fun __fun) const
{
- return {{}, {}, {(_Fun&&)__fun}};
+ return {{}, {}, {static_cast<_Fun&&>(__fun)}};
}
using _Sender = __1;
@@ -3124,11 +3161,11 @@
if constexpr (std::same_as<_Tag, set_error_t>)
{
stdexec::__set_value_invoke(std::move(__rcvr), std::move(__state),
- (_Args&&)__args...);
+ static_cast<_Args&&>(__args)...);
}
else
{
- _Tag()(std::move(__rcvr), (_Args&&)__args...);
+ _Tag()(std::move(__rcvr), static_cast<_Args&&>(__args)...);
}
};
};
@@ -3163,21 +3200,22 @@
{
template <sender _Sender, __movable_value _Fun>
requires __callable<_Fun>
- auto operator()(_Sender&& __sndr, _Fun __fun) const
+ auto operator()(_Sender&& __sndr, _Fun __fun) const -> __well_formed_sender
+ auto
{
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
__domain,
- __make_sexpr<upon_stopped_t>((_Fun&&)__fun, (_Sender&&)__sndr));
+ __make_sexpr<upon_stopped_t>(static_cast<_Fun&&>(__fun),
+ static_cast<_Sender&&>(__sndr)));
}
template <__movable_value _Fun>
requires __callable<_Fun>
- STDEXEC_ATTRIBUTE((always_inline)) //
- __binder_back<upon_stopped_t, _Fun>
+ STDEXEC_ATTRIBUTE((always_inline)) __binder_back<upon_stopped_t, _Fun>
operator()(_Fun __fun) const
{
- return {{}, {}, {(_Fun&&)__fun}};
+ return {{}, {}, {static_cast<_Fun&&>(__fun)}};
}
using _Sender = __1;
@@ -3207,11 +3245,11 @@
if constexpr (std::same_as<_Tag, set_stopped_t>)
{
stdexec::__set_value_invoke(std::move(__rcvr), std::move(__state),
- (_Args&&)__args...);
+ static_cast<_Args&&>(__args)...);
}
else
{
- _Tag()(std::move(__rcvr), (_Args&&)__args...);
+ _Tag()(std::move(__rcvr), static_cast<_Args&&>(__args)...);
}
};
};
@@ -3236,7 +3274,8 @@
struct __data
{
_Shape __shape_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fun __fun_;
static constexpr auto __mbrs_ =
__mliterals<&__data::__shape_, &__data::__fun_>();
};
@@ -3269,19 +3308,23 @@
template <sender _Sender, integral _Shape, __movable_value _Fun>
STDEXEC_ATTRIBUTE((host, device))
auto operator()(_Sender&& __sndr, _Shape __shape, _Fun __fun) const
+ -> __well_formed_sender auto
{
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
- __domain, __make_sexpr<bulk_t>(__data{__shape, (_Fun&&)__fun},
- (_Sender&&)__sndr));
+ __domain,
+ __make_sexpr<bulk_t>(__data{__shape, static_cast<_Fun&&>(__fun)},
+ static_cast<_Sender&&>(__sndr)));
}
template <integral _Shape, class _Fun>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__binder_back<bulk_t, _Shape, _Fun> operator()(_Shape __shape,
_Fun __fun) const
{
- return {{}, {}, {(_Shape&&)__shape, (_Fun&&)__fun}};
+ return {{},
+ {},
+ {static_cast<_Shape&&>(__shape), static_cast<_Fun&&>(__fun)}};
}
// This describes how to use the pieces of a bulk sender to find
@@ -3326,7 +3369,7 @@
{
__state.__fun_(__i, __args...);
}
- _Tag()(std::move(__rcvr), (_Args&&)__args...);
+ _Tag()(std::move(__rcvr), static_cast<_Args&&>(__args)...);
}
else
{
@@ -3336,7 +3379,7 @@
{
__state.__fun_(__i, __args...);
}
- _Tag()(std::move(__rcvr), (_Args&&)__args...);
+ _Tag()(std::move(__rcvr), static_cast<_Args&&>(__args)...);
}
catch (...)
{
@@ -3346,7 +3389,7 @@
}
else
{
- _Tag()(std::move(__rcvr), (_Args&&)__args...);
+ _Tag()(std::move(__rcvr), static_cast<_Args&&>(__args)...);
}
};
};
@@ -3397,12 +3440,13 @@
};
template <class _Receiver>
-auto __notify_visitor(_Receiver&& __rcvr) noexcept
+auto __notify_visitor(_Receiver& __rcvr) noexcept
{
return [&]<class _Tuple>(_Tuple&& __tupl) noexcept -> void {
__apply(
[&](auto __tag, auto&&... __args) noexcept -> void {
- __tag(std::move(__rcvr), __forward_like<_Tuple>(__args)...);
+ __tag(static_cast<_Receiver&&>(__rcvr),
+ __forward_like<_Tuple>(__args)...);
},
__tupl);
};
@@ -3447,10 +3491,10 @@
explicit __local_state(_CvrefSender&& __sndr) noexcept :
__local_state::__local_state_base{{},
&__action<tag_of_t<_CvrefSender>>},
- __shared_state_(
- STDEXEC_CALL_EXPLICIT_THIS_MEMFN((_CvrefSender&&)__sndr,
- apply)(__detail::__get_data())
- .__shared_state)
+ __shared_state_(STDEXEC_CALL_EXPLICIT_THIS_MEMFN(
+ static_cast<_CvrefSender&&>(__sndr),
+ apply)(__detail::__get_data())
+ .__shared_state)
{}
~__local_state()
@@ -3465,7 +3509,7 @@
static void __action(__local_state_base* __self,
__action_kind __kind) noexcept
{
- __local_state* const __op = static_cast<__local_state*>(__self);
+ auto* const __op = static_cast<__local_state*>(__self);
if (__kind == __action_kind::__notify)
{
__op->__on_stop_.reset();
@@ -3526,8 +3570,8 @@
try
{
using __tuple_t = __decayed_tuple<_Tag, _As...>;
- __state.__data_.template emplace<__tuple_t>(__tag,
- (_As&&)__as...);
+ __state.__data_.template emplace<__tuple_t>(
+ __tag, static_cast<_As&&>(__as)...);
}
catch (...)
{
@@ -3540,8 +3584,8 @@
__state.__notify();
}
- friend const __env_t<_Env>& tag_invoke(get_env_t,
- const __t& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __self) noexcept
+ -> const __env_t<_Env>&
{
return __self.__shared_state_->__env_;
}
@@ -3572,8 +3616,9 @@
explicit __shared_state(_CvrefSender&& __sndr, _Env __env) :
__env_(__env::__join(
__env::__with(__stop_source_.get_token(), get_stop_token),
- (_Env&&)__env)),
- __op_state2_(connect((_CvrefSender&&)__sndr, __receiver_t{this}))
+ static_cast<_Env&&>(__env))),
+ __op_state2_(
+ connect(static_cast<_CvrefSender&&>(__sndr), __receiver_t{this}))
{}
void __start_op() noexcept
@@ -3603,7 +3648,7 @@
void* const __completion_state = static_cast<void*>(this);
void* const __old = __head_.exchange(__completion_state,
std::memory_order_acq_rel);
- __local_state_base* __state = static_cast<__local_state_base*>(__old);
+ auto* __state = static_cast<__local_state_base*>(__old);
while (__state != nullptr)
{
@@ -3670,7 +3715,8 @@
_Sender&& __sndr,
_Receiver&) noexcept -> __local_state<_Sender, _Receiver> {
static_assert(sender_expr_for<_Sender, _Tag>);
- return __local_state<_Sender, _Receiver>{(_Sender&&)__sndr};
+ return __local_state<_Sender, _Receiver>{
+ static_cast<_Sender&&>(__sndr)};
};
static constexpr auto get_completion_signatures = //
@@ -3703,7 +3749,7 @@
{
// Stop has already been requested. Don't bother starting
// the child operations.
- stdexec::set_stopped((_Receiver&&)__rcvr);
+ stdexec::set_stopped(static_cast<_Receiver&&>(__rcvr));
return;
}
}
@@ -3763,13 +3809,16 @@
template <sender _Sender, class _Env = empty_env>
requires sender_in<_Sender, _Env> && __decay_copyable<env_of_t<_Sender>>
auto operator()(_Sender&& __sndr, _Env&& __env = {}) const
+ -> __well_formed_sender auto
{
auto __domain = __get_late_domain(__sndr, __env);
return stdexec::transform_sender(
- __domain, __make_sexpr<split_t>((_Env&&)__env, (_Sender&&)__sndr));
+ __domain, __make_sexpr<split_t>(static_cast<_Env&&>(__env),
+ static_cast<_Sender&&>(__sndr)));
}
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
+
__binder_back<split_t> operator()() const
{
return {{}, {}, {}};
@@ -3793,12 +3842,12 @@
using _Receiver =
__receiver_t<__child_of<_Sender>, __decay_t<__data_of<_Sender>>>;
static_assert(sender_to<__child_of<_Sender>, _Receiver>);
- return __sexpr_apply((_Sender&&)__sndr,
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
[&]<class _Env, class _Child>(
__ignore, _Env&& __env, _Child&& __child) {
auto __state =
__make_intrusive<__shared_state<_Child, __decay_t<_Env>>>(
- (_Child&&)__child, (_Env&&)__env);
+ static_cast<_Child&&>(__child), static_cast<_Env&&>(__env));
return __make_sexpr<__split_t>(__data{std::move(__state)});
});
}
@@ -3832,7 +3881,7 @@
}
__data(__data&&) noexcept = default;
- __data& operator=(__data&&) noexcept = default;
+ auto operator=(__data&&) noexcept -> __data& = default;
~__data()
{
@@ -3855,22 +3904,24 @@
template <sender _Sender, class _Env = empty_env>
requires sender_in<_Sender, _Env> && __decay_copyable<env_of_t<_Sender>>
[[nodiscard]] auto operator()(_Sender&& __sndr, _Env&& __env = {}) const
+ -> __well_formed_sender auto
{
if constexpr (sender_expr_for<_Sender, __ensure_started_t>)
{
- return (_Sender&&)__sndr;
+ return static_cast<_Sender&&>(__sndr);
}
else
{
auto __domain = __get_late_domain(__sndr, __env);
return stdexec::transform_sender(
- __domain, __make_sexpr<ensure_started_t>((_Env&&)__env,
- (_Sender&&)__sndr));
+ __domain,
+ __make_sexpr<ensure_started_t>(static_cast<_Env&&>(__env),
+ static_cast<_Sender&&>(__sndr)));
}
- STDEXEC_UNREACHABLE();
}
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
+
__binder_back<ensure_started_t> operator()() const
{
return {{}, {}, {}};
@@ -3894,12 +3945,12 @@
using _Receiver =
__receiver_t<__child_of<_Sender>, __decay_t<__data_of<_Sender>>>;
static_assert(sender_to<__child_of<_Sender>, _Receiver>);
- return __sexpr_apply((_Sender&&)__sndr,
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
[&]<class _Env, class _Child>(
__ignore, _Env&& __env, _Child&& __child) {
auto __state =
__make_intrusive<__shared_state<_Child, __decay_t<_Env>>>(
- (_Child&&)__child, (_Env&&)__env);
+ static_cast<_Child&&>(__child), static_cast<_Env&&>(__env));
return __make_sexpr<__ensure_started_t>(__data{std::move(__state)});
});
}
@@ -3936,12 +3987,12 @@
_Operation* __op_state_;
- _Receiver&& base() && noexcept
+ auto base() && noexcept -> _Receiver&&
{
return static_cast<_Receiver&&>(__op_state_->*_ReceiverPtr);
}
- __env_t get_env() const noexcept
+ auto get_env() const noexcept -> __env_t
{
return __env::__join(_EnvFns(__op_state_)...,
stdexec::get_env(__op_state_->*_ReceiverPtr));
@@ -3991,7 +4042,8 @@
class... _As>
friend void tag_invoke(_Tag, _Self&& __self, _As&&... __as) noexcept
{
- _Tag()((_Receiver&&)__self.__rcvr_, (_As&&)__as...);
+ _Tag()(static_cast<_Receiver&&>(__self.__rcvr_),
+ static_cast<_As&&>(__as)...);
}
template <same_as<get_env_t> _Tag>
@@ -4163,7 +4215,6 @@
__env::__without(__env, get_domain));
}
}
- STDEXEC_UNREACHABLE();
};
}
@@ -4189,17 +4240,16 @@
else if constexpr (same_as<_Domain, dependent_domain>)
{
using _Domain2 = __late_domain_of_t<_Child, _Env>;
- return __make_sexpr<__let_t<_Set, _Domain2>>((_Fun&&)__fun,
- (_Child&&)__child);
+ return __make_sexpr<__let_t<_Set, _Domain2>>(
+ static_cast<_Fun&&>(__fun), static_cast<_Child&&>(__child));
}
else
{
static_assert(!same_as<_Domain, __none_such>);
- return __make_sexpr<__let_t<_Set, _Domain>>((_Fun&&)__fun,
- (_Child&&)__child);
+ return __make_sexpr<__let_t<_Set, _Domain>>(
+ static_cast<_Fun&&>(__fun), static_cast<_Child&&>(__child));
}
}
- STDEXEC_UNREACHABLE();
};
}
@@ -4218,15 +4268,16 @@
__nullable_variant_t>,
_Tuples...>;
- decltype(auto) __get_result_receiver(_Receiver&& __rcvr)
+ auto __get_result_receiver(_Receiver&& __rcvr) -> decltype(auto)
{
if constexpr (__unknown_context<_Sched>)
{
- return (_Receiver&&)__rcvr;
+ return static_cast<_Receiver&&>(__rcvr);
}
else
{
- return __receiver_with_sched{(_Receiver&&)__rcvr, this->__sched_};
+ return __receiver_with_sched{static_cast<_Receiver&&>(__rcvr),
+ this->__sched_};
}
}
@@ -4243,19 +4294,21 @@
using __t = _Set;
template <sender _Sender, __movable_value _Fun>
- auto operator()(_Sender&& __sndr, _Fun __fun) const
+ auto operator()(_Sender&& __sndr, _Fun __fun) const -> __well_formed_sender
+ auto
{
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
__domain,
- __make_sexpr<__let_t<_Set>>((_Fun&&)__fun, (_Sender&&)__sndr));
+ __make_sexpr<__let_t<_Set>>(static_cast<_Fun&&>(__fun),
+ static_cast<_Sender&&>(__sndr)));
}
template <class _Fun>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__binder_back<__let_t, _Fun> operator()(_Fun __fun) const
{
- return {{}, {}, {(_Fun&&)__fun}};
+ return {{}, {}, {static_cast<_Fun&&>(__fun)}};
}
using _Sender = __1;
@@ -4268,17 +4321,19 @@
tag_invoke_t(__let_t, _Sender, _Function)>;
template <sender_expr_for<__let_t<_Set>> _Sender, class _Env>
- static decltype(auto) transform_env(_Sender&& __sndr, const _Env& __env)
+ static auto transform_env(_Sender&& __sndr, const _Env& __env)
+ -> decltype(auto)
{
- return __sexpr_apply((_Sender&&)__sndr,
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
__mk_transform_env_fn<__let_t<_Set>>(__env));
}
template <sender_expr_for<__let_t<_Set>> _Sender, class _Env>
requires same_as<__early_domain_of_t<_Sender>, dependent_domain>
- static decltype(auto) transform_sender(_Sender&& __sndr, const _Env& __env)
+ static auto transform_sender(_Sender&& __sndr, const _Env& __env)
+ -> decltype(auto)
{
- return __sexpr_apply((_Sender&&)__sndr,
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
__mk_transform_sender_fn<__let_t<_Set>>(__env));
}
};
@@ -4316,7 +4371,7 @@
_Sched __sched = query_or(get_completion_scheduler<_Set>,
stdexec::get_env(__sndr), __none_such());
return __let_state_t{
- STDEXEC_CALL_EXPLICIT_THIS_MEMFN((_Sender&&)__sndr,
+ STDEXEC_CALL_EXPLICIT_THIS_MEMFN(static_cast<_Sender&&>(__sndr),
apply)(__detail::__get_data()),
__sched};
};
@@ -4329,9 +4384,10 @@
{
auto& __args =
__state.__args_.template emplace<__decayed_tuple<_As...>>(
- (_As&&)__as...);
+ static_cast<_As&&>(__as)...);
auto __sndr2 = __apply(std::move(__state.__fun_), __args);
- auto __rcvr2 = __state.__get_result_receiver((_Receiver&&)__rcvr);
+ auto __rcvr2 =
+ __state.__get_result_receiver(static_cast<_Receiver&&>(__rcvr));
auto __mkop = [&] {
return stdexec::connect(std::move(__sndr2), std::move(__rcvr2));
};
@@ -4352,11 +4408,12 @@
_As&&... __as) noexcept -> void {
if constexpr (std::same_as<_Tag, _Set>)
{
- __bind(__state, __rcvr, (_As&&)__as...);
+ __bind(__state, __rcvr, static_cast<_As&&>(__as)...);
}
else
{
- _Tag()((_Receiver&&)__rcvr, (_As&&)__as...);
+ _Tag()(static_cast<_Receiver&&>(__rcvr),
+ static_cast<_As&&>(__as)...);
}
};
};
@@ -4386,10 +4443,12 @@
template <sender _Sender>
auto operator()(_Sender&& __sndr) const
{
- return __make_sexpr<stopped_as_optional_t>(__(), (_Sender&&)__sndr);
+ return __make_sexpr<stopped_as_optional_t>(
+ __(), static_cast<_Sender&&>(__sndr));
}
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
+
__binder_back<stopped_as_optional_t> operator()() const noexcept
{
return {};
@@ -4435,23 +4494,24 @@
try
{
static_assert(constructible_from<__t<_State>, _Args...>);
- stdexec::set_value(
- (_Receiver&&)__rcvr,
- std::optional<__t<_State>>{(_Args&&)__args...});
+ stdexec::set_value(static_cast<_Receiver&&>(__rcvr),
+ std::optional<__t<_State>>{
+ static_cast<_Args&&>(__args)...});
}
catch (...)
{
- stdexec::set_error((_Receiver&&)__rcvr,
+ stdexec::set_error(static_cast<_Receiver&&>(__rcvr),
std::current_exception());
}
}
else if constexpr (same_as<_Tag, set_error_t>)
{
- stdexec::set_error((_Receiver&&)__rcvr, (_Args&&)__args...);
+ stdexec::set_error(static_cast<_Receiver&&>(__rcvr),
+ static_cast<_Args&&>(__args)...);
}
else
{
- stdexec::set_value((_Receiver&&)__rcvr,
+ stdexec::set_value(static_cast<_Receiver&&>(__rcvr),
std::optional<__t<_State>>{std::nullopt});
}
};
@@ -4462,20 +4522,20 @@
template <sender _Sender, __movable_value _Error>
auto operator()(_Sender&& __sndr, _Error __err) const
{
- return (_Sender&&)__sndr |
+ return static_cast<_Sender&&>(__sndr) |
let_stopped(
- [__err2 = (_Error&&)__err]() mutable //
+ [__err2 = static_cast<_Error&&>(__err)]() mutable //
noexcept(std::is_nothrow_move_constructible_v<_Error>) {
- return just_error((_Error&&)__err2);
+ return just_error(static_cast<_Error&&>(__err2));
});
}
template <__movable_value _Error>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
auto operator()(_Error __err) const
-> __binder_back<stopped_as_error_t, _Error>
{
- return {{}, {}, {(_Error&&)__err}};
+ return {{}, {}, {static_cast<_Error&&>(__err)}};
}
};
} // namespace __stopped_as_xxx
@@ -4522,25 +4582,27 @@
using __id = __operation;
run_loop* __loop_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Receiver __rcvr_;
static void __execute_impl(__task* __p) noexcept
{
- auto& __rcvr = ((__t*)__p)->__rcvr_;
+ auto& __rcvr = static_cast<__t*>(__p)->__rcvr_;
try
{
if (get_stop_token(get_env(__rcvr)).stop_requested())
{
- set_stopped((_Receiver&&)__rcvr);
+ set_stopped(static_cast<_Receiver&&>(__rcvr));
}
else
{
- set_value((_Receiver&&)__rcvr);
+ set_value(static_cast<_Receiver&&>(__rcvr));
}
}
catch (...)
{
- set_error((_Receiver&&)__rcvr, std::current_exception());
+ set_error(static_cast<_Receiver&&>(__rcvr),
+ std::current_exception());
}
}
@@ -4548,7 +4610,7 @@
__t(__task* __next, run_loop* __loop, _Receiver __rcvr) :
__task{{}, __next, {&__execute_impl}}, __loop_{__loop},
- __rcvr_{(_Receiver&&)__rcvr}
+ __rcvr_{static_cast<_Receiver&&>(__rcvr)}
{}
friend void tag_invoke(start_t, __t& __self) noexcept
@@ -4573,7 +4635,7 @@
{
using __t = __scheduler;
using __id = __scheduler;
- bool operator==(const __scheduler&) const noexcept = default;
+ auto operator==(const __scheduler&) const noexcept -> bool = default;
private:
struct __schedule_task
@@ -4594,17 +4656,17 @@
stdexec::__t<__operation<stdexec::__id<_Receiver>>>;
template <class _Receiver>
- friend __operation<_Receiver>
- tag_invoke(connect_t, const __schedule_task& __self,
- _Receiver __rcvr)
+ friend auto tag_invoke(connect_t, const __schedule_task& __self,
+ _Receiver __rcvr) -> __operation<_Receiver>
{
- return __self.__connect_((_Receiver&&)__rcvr);
+ return __self.__connect_(static_cast<_Receiver&&>(__rcvr));
}
template <class _Receiver>
- __operation<_Receiver> __connect_(_Receiver&& __rcvr) const
+ auto __connect_(_Receiver&& __rcvr) const -> __operation<_Receiver>
{
- return {&__loop_->__head_, __loop_, (_Receiver&&)__rcvr};
+ return {&__loop_->__head_, __loop_,
+ static_cast<_Receiver&&>(__rcvr)};
}
struct __env
@@ -4612,15 +4674,17 @@
run_loop* __loop_;
template <class _CPO>
- friend __scheduler tag_invoke(get_completion_scheduler_t<_CPO>,
- const __env& __self) noexcept
+ friend auto tag_invoke(get_completion_scheduler_t<_CPO>,
+ const __env& __self) noexcept
+ -> __scheduler
{
return __self.__loop_->get_scheduler();
}
};
- friend __env tag_invoke(get_env_t,
- const __schedule_task& __self) noexcept
+ friend auto tag_invoke(get_env_t,
+ const __schedule_task& __self) noexcept
+ -> __env
{
return __env{__self.__loop_};
}
@@ -4636,27 +4700,27 @@
explicit __scheduler(run_loop* __loop) noexcept : __loop_(__loop) {}
- friend __schedule_task tag_invoke(schedule_t,
- const __scheduler& __self) noexcept
+ friend auto tag_invoke(schedule_t, const __scheduler& __self) noexcept
+ -> __schedule_task
{
return __self.__schedule();
}
- friend stdexec::forward_progress_guarantee
- tag_invoke(get_forward_progress_guarantee_t,
- const __scheduler&) noexcept
+ friend auto tag_invoke(get_forward_progress_guarantee_t,
+ const __scheduler&) noexcept
+ -> stdexec::forward_progress_guarantee
{
return stdexec::forward_progress_guarantee::parallel;
}
// BUGBUG NOT TO SPEC
- friend bool tag_invoke(execute_may_block_caller_t,
- const __scheduler&) noexcept
+ friend auto tag_invoke(execute_may_block_caller_t,
+ const __scheduler&) noexcept -> bool
{
return false;
}
- __schedule_task __schedule() const noexcept
+ [[nodiscard]] auto __schedule() const noexcept -> __schedule_task
{
return __schedule_task{__loop_};
}
@@ -4664,7 +4728,7 @@
run_loop* __loop_;
};
- __scheduler get_scheduler() noexcept
+ auto get_scheduler() noexcept -> __scheduler
{
return __scheduler{this};
}
@@ -4675,7 +4739,7 @@
private:
void __push_back_(__task* __task);
- __task* __pop_front_();
+ auto __pop_front_() -> __task*;
std::mutex __mutex_;
std::condition_variable __cv_;
@@ -4692,7 +4756,7 @@
}
catch (...)
{
- set_error((_Receiver&&)__rcvr_, std::current_exception());
+ set_error(static_cast<_Receiver&&>(__rcvr_), std::current_exception());
}
}
@@ -4719,7 +4783,7 @@
__cv_.notify_one();
}
-inline __task* run_loop::__pop_front_()
+inline auto run_loop::__pop_front_() -> __task*
{
std::unique_lock __lock{__mutex_};
__cv_.wait(__lock,
@@ -4790,6 +4854,7 @@
struct __environ
{
using _Scheduler = stdexec::__t<_SchedulerId>;
+
struct __t :
__env::__with<stdexec::__t<_SchedulerId>,
get_completion_scheduler_t<set_value_t>,
@@ -4828,12 +4893,12 @@
__state_{__state}
{}
- _Receiver&& base() && noexcept
+ auto base() && noexcept -> _Receiver&&
{
return std::move(__state_->__receiver());
}
- const _Receiver& base() const& noexcept
+ auto base() const& noexcept -> const _Receiver&
{
return __state_->__receiver();
}
@@ -4853,7 +4918,8 @@
__apply(
[&]<class... _Args>(auto __tag,
_Args&... __args) noexcept -> void {
- __tag(std::move(__state->__receiver()), (_Args&&)__args...);
+ __tag(std::move(__state->__receiver()),
+ static_cast<_Args&&>(__args)...);
},
__tupl);
}
@@ -4883,13 +4949,14 @@
{
template <scheduler _Scheduler, sender _Sender>
auto operator()(_Scheduler&& __sched, _Sender&& __sndr) const
+ -> __well_formed_sender auto
{
using _Env = __t<__environ<__id<__decay_t<_Scheduler>>>>;
- auto __env = _Env{{(_Scheduler&&)__sched}};
+ auto __env = _Env{{static_cast<_Scheduler&&>(__sched)}};
auto __domain = query_or(get_domain, __sched, default_domain());
return stdexec::transform_sender(
- __domain,
- __make_sexpr<schedule_from_t>(std::move(__env), (_Sender&&)__sndr));
+ __domain, __make_sexpr<schedule_from_t>(
+ std::move(__env), static_cast<_Sender&&>(__sndr)));
}
using _Sender = __1;
@@ -4940,14 +5007,14 @@
_Args...>)
{
__state.__data_.template emplace<__async_result>(
- _Tag(), (_Args&&)__args...);
+ _Tag(), static_cast<_Args&&>(__args)...);
}
else
{
try
{
__state.__data_.template emplace<__async_result>(
- _Tag(), (_Args&&)__args...);
+ _Tag(), static_cast<_Args&&>(__args)...);
}
catch (...)
{
@@ -4987,20 +5054,22 @@
{
template <sender _Sender, scheduler _Scheduler>
auto operator()(_Sender&& __sndr, _Scheduler&& __sched) const
+ -> __well_formed_sender auto
{
auto __domain = __get_early_domain(__sndr);
using _Env = __t<__environ<__id<__decay_t<_Scheduler>>>>;
return stdexec::transform_sender(
- __domain, __make_sexpr<transfer_t>(_Env{{(_Scheduler&&)__sched}},
- (_Sender&&)__sndr));
+ __domain,
+ __make_sexpr<transfer_t>(_Env{{static_cast<_Scheduler&&>(__sched)}},
+ static_cast<_Sender&&>(__sndr)));
}
template <scheduler _Scheduler>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__binder_back<transfer_t, __decay_t<_Scheduler>>
operator()(_Scheduler&& __sched) const
{
- return {{}, {}, {(_Scheduler&&)__sched}};
+ return {{}, {}, {static_cast<_Scheduler&&>(__sched)}};
}
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -5021,14 +5090,16 @@
return [&]<class _Data, class _Child>(__ignore, _Data&& __data,
_Child&& __child) {
auto __sched = get_completion_scheduler<set_value_t>(__data);
- return schedule_from(std::move(__sched), (_Child&&)__child);
+ return schedule_from(std::move(__sched),
+ static_cast<_Child&&>(__child));
};
}
template <class _Sender, class _Env>
static auto transform_sender(_Sender&& __sndr, const _Env& __env)
{
- return __sexpr_apply((_Sender&&)__sndr, __transform_sender_fn(__env));
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
+ __transform_sender_fn(__env));
}
};
@@ -5059,7 +5130,7 @@
{
return []<class... _Ts>(
_Ts&&... __ts) -> tag_invoke_result_t<transfer_just_t, _Ts...> {
- return tag_invoke(transfer_just, (_Ts&&)__ts...);
+ return tag_invoke(transfer_just, static_cast<_Ts&&>(__ts)...);
};
}
@@ -5068,7 +5139,8 @@
{
return [&]<class _Scheduler, class... _Values>(_Scheduler&& __sched,
_Values&&... __vals) {
- return transfer(just((_Values&&)__vals...), (_Scheduler&&)__sched);
+ return transfer(just(static_cast<_Values&&>(__vals)...),
+ static_cast<_Scheduler&&>(__sched));
};
}
@@ -5076,7 +5148,8 @@
auto __transform_sender_fn(const _Env& __env)
{
return [&]<class _Data>(__ignore, _Data&& __data) {
- return __apply(__make_transform_fn(__env), (_Data&&)__data);
+ return __apply(__make_transform_fn(__env),
+ static_cast<_Data&&>(__data));
};
}
@@ -5088,17 +5161,20 @@
template <scheduler _Scheduler, __movable_value... _Values>
auto operator()(_Scheduler&& __sched, _Values&&... __vals) const
+ -> __well_formed_sender auto
{
auto __domain = query_or(get_domain, __sched, default_domain());
return stdexec::transform_sender(
- __domain, __make_sexpr<transfer_just_t>(std::tuple{
- (_Scheduler&&)__sched, (_Values&&)__vals...}));
+ __domain, __make_sexpr<transfer_just_t>(
+ std::tuple{static_cast<_Scheduler&&>(__sched),
+ static_cast<_Values&&>(__vals)...}));
}
template <class _Sender, class _Env>
static auto transform_sender(_Sender&& __sndr, const _Env& __env)
{
- return __sexpr_apply((_Sender&&)__sndr, __transform_sender_fn(__env));
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
+ __transform_sender_fn(__env));
}
};
@@ -5137,11 +5213,11 @@
auto operator()(_Sender&& __sndr, _Envs... __envs) const
{
return __make_sexpr<__write_t>(__env::__join(std::move(__envs)...),
- (_Sender&&)__sndr);
+ static_cast<_Sender&&>(__sndr));
}
template <class... _Envs>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
auto operator()(_Envs... __envs) const -> __binder_back<__write_t, _Envs...>
{
return {{}, {}, {std::move(__envs)...}};
@@ -5152,14 +5228,15 @@
static auto __transform_env_fn(_Env&& __env) noexcept
{
return [&](__ignore, const auto& __state, __ignore) noexcept {
- return __env::__join(__state, (_Env&&)__env);
+ return __env::__join(__state, static_cast<_Env&&>(__env));
};
}
template <sender_expr_for<__write_t> _Self, class _Env>
static auto transform_env(const _Self& __self, _Env&& __env) noexcept
{
- return __sexpr_apply(__self, __transform_env_fn((_Env&&)__env));
+ return __sexpr_apply(__self,
+ __transform_env_fn(static_cast<_Env&&>(__env)));
}
};
@@ -5194,14 +5271,15 @@
STDEXEC_ATTRIBUTE((always_inline))
auto __mkenv_sched(_Env&& __env, _Scheduler __sched)
{
- auto __env2 = __env::__join(__env::__with(__sched, get_scheduler),
- __env::__without((_Env&&)__env, get_domain));
+ auto __env2 =
+ __env::__join(__env::__with(__sched, get_scheduler),
+ __env::__without(static_cast<_Env&&>(__env), get_domain));
using _Env2 = decltype(__env2);
struct __env_t : _Env2
{};
- return __env_t{(_Env2&&)__env2};
+ return __env_t{static_cast<_Env2&&>(__env2)};
}
template <class _Ty, class = __name_of<__decay_t<_Ty>>>
@@ -5209,7 +5287,7 @@
{
_Ty __val_;
- _Ty operator()() noexcept
+ auto operator()() noexcept -> _Ty
{
return static_cast<_Ty&&>(__val_);
}
@@ -5232,11 +5310,12 @@
template <scheduler _Scheduler, sender _Sender>
auto operator()(_Scheduler&& __sched, _Sender&& __sndr) const
+ -> __well_formed_sender auto
{
auto __domain = query_or(get_domain, __sched, default_domain());
return stdexec::transform_sender(
- __domain,
- __make_sexpr<on_t>((_Scheduler&&)__sched, (_Sender&&)__sndr));
+ __domain, __make_sexpr<on_t>(static_cast<_Scheduler&&>(__sched),
+ static_cast<_Sender&&>(__sndr)));
}
template <class _Env>
@@ -5244,24 +5323,26 @@
static auto __transform_env_fn(_Env&& __env) noexcept
{
return [&](__ignore, auto __sched, __ignore) noexcept {
- return __detail::__mkenv_sched((_Env&&)__env, __sched);
+ return __detail::__mkenv_sched(static_cast<_Env&&>(__env), __sched);
};
}
template <class _Sender, class _Env>
static auto transform_env(const _Sender& __sndr, _Env&& __env) noexcept
{
- return __sexpr_apply(__sndr, __transform_env_fn((_Env&&)__env));
+ return __sexpr_apply(__sndr,
+ __transform_env_fn(static_cast<_Env&&>(__env)));
}
template <class _Sender, class _Env>
static auto transform_sender(_Sender&& __sndr, const _Env&)
{
- return __sexpr_apply((_Sender&&)__sndr,
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
[]<class _Data, class _Child>(
__ignore, _Data&& __data, _Child&& __child) {
- return let_value(schedule(__data),
- __detail::__always{(_Child&&)__child});
+ return let_value(
+ schedule(__data),
+ __detail::__always{static_cast<_Child&&>(__child)});
});
}
};
@@ -5296,7 +5377,7 @@
struct into_variant_t
{
template <sender _Sender>
- auto operator()(_Sender&& __sndr) const
+ auto operator()(_Sender&& __sndr) const -> __well_formed_sender auto
{
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
@@ -5304,7 +5385,8 @@
__make_sexpr<into_variant_t>(__(), std::forward<_Sender>(__sndr)));
}
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
+
auto operator()() const noexcept
{
return __binder_back<into_variant_t>{};
@@ -5329,18 +5411,20 @@
using __variant_t = __t<_State>;
try
{
- set_value(
- (_Receiver&&)__rcvr,
- __variant_t{std::tuple<_Args&&...>{(_Args&&)__args...}});
+ set_value(static_cast<_Receiver&&>(__rcvr),
+ __variant_t{std::tuple<_Args&&...>{
+ static_cast<_Args&&>(__args)...}});
}
catch (...)
{
- set_error((_Receiver&&)__rcvr, std::current_exception());
+ set_error(static_cast<_Receiver&&>(__rcvr),
+ std::current_exception());
}
}
else
{
- _Tag()((_Receiver&&)__rcvr, (_Args&&)__args...);
+ _Tag()(static_cast<_Receiver&&>(__rcvr),
+ static_cast<_Args&&>(__args)...);
}
};
@@ -5387,7 +5471,7 @@
{
return __env::__join(
__env::__with(__stop_source.get_token(), get_stop_token),
- (_Env&&)__env);
+ static_cast<_Env&&>(__env));
}
template <class _Env>
@@ -5464,7 +5548,7 @@
struct __tie_fn
{
template <class... _Ty>
- std::tuple<_Ty&...> operator()(_Ty&... __vals) noexcept
+ auto operator()(_Ty&... __vals) noexcept -> std::tuple<_Ty&...>
{
return std::tuple<_Ty&...>{__vals...};
}
@@ -5476,7 +5560,8 @@
return [&]<class... _Ts>(_Ts&... __ts) noexcept {
if constexpr (!same_as<__types<_Ts...>, __types<__not_an_error>>)
{
- _Tag()((_Receiver&&)__rcvr, (_Ts&&)__ts...);
+ _Tag()(static_cast<_Receiver&&>(__rcvr),
+ static_cast<_Ts&&>(__ts)...);
}
};
}
@@ -5484,19 +5569,21 @@
template <class _Receiver, class _ValuesTuple>
void __set_values(_Receiver& __rcvr, _ValuesTuple& __values) noexcept
{
- __apply(
+ __tup::__apply(
[&](auto&... __opt_vals) noexcept -> void {
__apply(__complete_fn(set_value, __rcvr), //
- std::tuple_cat(__apply(__tie_fn{}, *__opt_vals)...));
+ std::tuple_cat(__tup::__apply(__tie_fn{}, *__opt_vals)...));
},
__values);
}
+template <class... Ts>
+using __decayed_custom_tuple = __tup::__tuple_for<__decay_t<Ts>...>;
+
template <class _Env, class _Sender>
using __values_opt_tuple_t = //
- __value_types_of_t<_Sender, __env_t<_Env>,
- __mcompose<__q<std::optional>, __q<__decayed_tuple>>,
- __q<__msingle>>;
+ value_types_of_t<_Sender, __env_t<_Env>, __decayed_custom_tuple,
+ std::optional>;
template <class _Env, __max1_sender<__env_t<_Env>>... _Senders>
struct __traits
@@ -5505,7 +5592,7 @@
using __values_tuple = //
__minvoke<__with_default<
__transform<__mbind_front_q<__values_opt_tuple_t, _Env>,
- __q<std::tuple>>,
+ __q<__tup::__tuple_for>>,
__ignore>,
_Senders...>;
@@ -5564,7 +5651,7 @@
}
break;
case __stopped:
- stdexec::set_stopped((_Receiver&&)__rcvr);
+ stdexec::set_stopped(static_cast<_Receiver&&>(__rcvr));
break;
default:;
}
@@ -5575,7 +5662,8 @@
// Could be non-atomic here and atomic_ref everywhere except __completion_fn
std::atomic<__state_t> __state_{__started};
_ErrorsVariant __errors_{};
- STDEXEC_ATTRIBUTE((no_unique_address)) _ValuesTuple __values_{};
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _ValuesTuple __values_{};
std::optional<__stop_callback_t> __on_stop_{};
};
@@ -5604,14 +5692,14 @@
using __legacy_customizations_t = //
__types<tag_invoke_t(when_all_t, _Sender...)>;
- // TODO: improve diagnostic when senders have different domains
template <sender... _Senders>
requires __domain::__has_common_domain<_Senders...>
- auto operator()(_Senders&&... __sndrs) const
+ auto operator()(_Senders&&... __sndrs) const -> __well_formed_sender auto
{
auto __domain = __domain::__common_domain_t<_Senders...>();
return stdexec::transform_sender(
- __domain, __make_sexpr<when_all_t>(__(), (_Senders&&)__sndrs...));
+ __domain, __make_sexpr<when_all_t>(
+ __(), static_cast<_Senders&&>(__sndrs)...));
}
};
@@ -5637,7 +5725,6 @@
{
return __env::__with(_Domain(), get_domain);
}
- STDEXEC_UNREACHABLE();
};
static constexpr auto get_completion_signatures = //
@@ -5657,8 +5744,9 @@
static constexpr auto get_state = //
[]<class _Self, class _Receiver>(_Self&& __self, _Receiver& __rcvr)
-> __sexpr_apply_result_t<_Self, __mk_state_fn_t<env_of_t<_Receiver>>> {
- return __sexpr_apply((_Self&&)__self, __when_all::__mk_state_fn(
- stdexec::get_env(__rcvr)));
+ return __sexpr_apply(
+ static_cast<_Self&&>(__self),
+ __when_all::__mk_state_fn(stdexec::get_env(__rcvr)));
};
static constexpr auto start = //
@@ -5697,14 +5785,14 @@
if constexpr (__nothrow_decay_copyable<_Error>)
{
__state.__errors_.template emplace<__decay_t<_Error>>(
- (_Error&&)__err);
+ static_cast<_Error&&>(__err));
}
else
{
try
{
__state.__errors_.template emplace<__decay_t<_Error>>(
- (_Error&&)__err);
+ static_cast<_Error&&>(__err));
}
catch (...)
{
@@ -5721,7 +5809,7 @@
_Args&&... __args) noexcept -> void {
if constexpr (same_as<_Set, set_error_t>)
{
- __set_error(__state, __rcvr, (_Args&&)__args...);
+ __set_error(__state, __rcvr, static_cast<_Args&&>(__args)...);
}
else if constexpr (same_as<_Set, set_stopped_t>)
{
@@ -5740,20 +5828,23 @@
// if we're not already in the "error" or "stopped" state.
if (__state.__state_ == __started)
{
- auto& __opt_values = std::get<__v<_Index>>(__state.__values_);
+ auto& __opt_values =
+ __tup::__get<__v<_Index>>(__state.__values_);
+ using _Tuple = __decayed_custom_tuple<_Args...>;
static_assert(
- same_as<decltype(*__opt_values),
- __decayed_tuple<_Args...>&>,
+ same_as<decltype(*__opt_values), _Tuple&>,
"One of the senders in this when_all() is fibbing about what types it sends");
if constexpr ((__nothrow_decay_copyable<_Args> && ...))
{
- __opt_values.emplace((_Args&&)__args...);
+ __opt_values.emplace(
+ _Tuple{{static_cast<_Args&&>(__args)}...});
}
else
{
try
{
- __opt_values.emplace((_Args&&)__args...);
+ __opt_values.emplace(
+ _Tuple{{static_cast<_Args&&>(__args)}...});
}
catch (...)
{
@@ -5775,12 +5866,12 @@
template <sender... _Senders>
requires __domain::__has_common_domain<_Senders...>
- auto operator()(_Senders&&... __sndrs) const
+ auto operator()(_Senders&&... __sndrs) const -> __well_formed_sender auto
{
auto __domain = __domain::__common_domain_t<_Senders...>();
- return stdexec::transform_sender(__domain,
- __make_sexpr<when_all_with_variant_t>(
- __(), (_Senders&&)__sndrs...));
+ return stdexec::transform_sender(
+ __domain, __make_sexpr<when_all_with_variant_t>(
+ __(), static_cast<_Senders&&>(__sndrs)...));
}
template <class _Sender, class _Env>
@@ -5790,9 +5881,10 @@
// for early when_all customizations), then transform it again to look
// for late customizations.
return __sexpr_apply(
- (_Sender&&)__sndr,
+ static_cast<_Sender&&>(__sndr),
[&]<class... _Child>(__ignore, __ignore, _Child&&... __child) {
- return when_all_t()(into_variant((_Child&&)__child)...);
+ return when_all_t()(
+ into_variant(static_cast<_Child&&>(__child))...);
});
}
};
@@ -5810,7 +5902,6 @@
{
return __env::__with(_Domain(), get_domain);
}
- STDEXEC_UNREACHABLE();
};
};
@@ -5826,13 +5917,15 @@
template <scheduler _Scheduler, sender... _Senders>
requires __domain::__has_common_domain<_Senders...>
auto operator()(_Scheduler&& __sched, _Senders&&... __sndrs) const
+ -> __well_formed_sender auto
{
using _Env =
__t<__schedule_from::__environ<__id<__decay_t<_Scheduler>>>>;
auto __domain = query_or(get_domain, __sched, default_domain());
return stdexec::transform_sender(
__domain, __make_sexpr<transfer_when_all_t>(
- _Env{(_Scheduler&&)__sched}, (_Senders&&)__sndrs...));
+ _Env{static_cast<_Scheduler&&>(__sched)},
+ static_cast<_Senders&&>(__sndrs)...));
}
template <class _Sender, class _Env>
@@ -5842,10 +5935,10 @@
// (looking for early customizations), then transform it again to look
// for late customizations.
return __sexpr_apply(
- (_Sender&&)__sndr,
+ static_cast<_Sender&&>(__sndr),
[&]<class _Data, class... _Child>(__ignore, _Data&& __data,
_Child&&... __child) {
- return transfer(when_all_t()((_Child&&)__child...),
+ return transfer(when_all_t()(static_cast<_Child&&>(__child)...),
get_completion_scheduler<set_value_t>(__data));
});
}
@@ -5872,14 +5965,15 @@
template <scheduler _Scheduler, sender... _Senders>
requires __domain::__has_common_domain<_Senders...>
auto operator()(_Scheduler&& __sched, _Senders&&... __sndrs) const
+ -> __well_formed_sender auto
{
using _Env =
__t<__schedule_from::__environ<__id<__decay_t<_Scheduler>>>>;
auto __domain = query_or(get_domain, __sched, default_domain());
return stdexec::transform_sender(
- __domain,
- __make_sexpr<transfer_when_all_with_variant_t>(
- _Env{{(_Scheduler&&)__sched}}, (_Senders&&)__sndrs...));
+ __domain, __make_sexpr<transfer_when_all_with_variant_t>(
+ _Env{{static_cast<_Scheduler&&>(__sched)}},
+ static_cast<_Senders&&>(__sndrs)...));
}
template <class _Sender, class _Env>
@@ -5890,12 +5984,13 @@
// customizations), then transform it again to look for late
// customizations.
return __sexpr_apply(
- (_Sender&&)__sndr,
+ static_cast<_Sender&&>(__sndr),
[&]<class _Data, class... _Child>(__ignore, _Data&& __data,
_Child&&... __child) {
return transfer_when_all_t()(
- get_completion_scheduler<set_value_t>((_Data&&)__data),
- into_variant((_Child&&)__child)...);
+ get_completion_scheduler<set_value_t>(
+ static_cast<_Data&&>(__data)),
+ into_variant(static_cast<_Child&&>(__child))...);
});
}
};
@@ -5997,6 +6092,8 @@
struct __read_impl : __sexpr_defaults
{
+ using is_dependent = void;
+
template <class _Tag, class _Env>
using __completions_t = __minvoke<
__mtry_catch_q<__read::__completions_t, __q<__query_failed_error>>,
@@ -6053,6 +6150,7 @@
namespace __queries
{
+template <class _Tag>
inline auto get_scheduler_t::operator()() const noexcept
{
return read(get_scheduler);
@@ -6068,6 +6166,7 @@
return tag_invoke(get_scheduler_t{}, __env);
}
+template <class _Tag>
inline auto get_delegatee_scheduler_t::operator()() const noexcept
{
return read(get_delegatee_scheduler);
@@ -6086,11 +6185,13 @@
return tag_invoke(get_delegatee_scheduler_t{}, std::as_const(__t));
}
+template <class _Tag>
inline auto get_allocator_t::operator()() const noexcept
{
return read(get_allocator);
}
+template <class _Tag>
inline auto get_stop_token_t::operator()() const noexcept
{
return read(get_stop_token);
@@ -6158,12 +6259,13 @@
{
template <scheduler _Scheduler, sender _Sender>
auto operator()(_Scheduler&& __sched, _Sender&& __sndr) const
+ -> __well_formed_sender auto
{
// BUGBUG __get_early_domain, or get_domain(__sched), or ...?
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
- __domain,
- __make_sexpr<on_t>((_Scheduler&&)__sched, (_Sender&&)__sndr));
+ __domain, __make_sexpr<on_t>(static_cast<_Scheduler&&>(__sched),
+ static_cast<_Sender&&>(__sndr)));
}
template <class _Env>
@@ -6171,14 +6273,15 @@
static auto __transform_env_fn(_Env&& __env) noexcept
{
return [&](__ignore, auto __sched, __ignore) noexcept {
- return __detail::__mkenv_sched((_Env&&)__env, __sched);
+ return __detail::__mkenv_sched(static_cast<_Env&&>(__env), __sched);
};
}
template <class _Sender, class _Env>
static auto transform_env(const _Sender& __sndr, _Env&& __env) noexcept
{
- return __sexpr_apply(__sndr, __transform_env_fn((_Env&&)__env));
+ return __sexpr_apply(__sndr,
+ __transform_env_fn(static_cast<_Env&&>(__env)));
}
using __no_scheduler_in_environment::transform_sender;
@@ -6188,13 +6291,14 @@
static auto transform_sender(_Sender&& __sndr, const _Env& __env)
{
return __sexpr_apply(
- (_Sender&&)__sndr,
+ static_cast<_Sender&&>(__sndr),
[&]<class _Scheduler, class _Child>(__ignore, _Scheduler __sched,
_Child&& __child) {
auto __old = get_scheduler(__env);
- return transfer(let_value(transfer_just(std::move(__sched)),
- __detail::__always{(_Child&&)__child}),
- std::move(__old));
+ return transfer(
+ let_value(transfer_just(std::move(__sched)),
+ __detail::__always{static_cast<_Child&&>(__child)}),
+ std::move(__old));
});
}
};
@@ -6214,8 +6318,8 @@
{
_Scheduler __sched_;
- friend _Scheduler tag_invoke(get_scheduler_t,
- const __with_sched& __self) noexcept
+ friend auto tag_invoke(get_scheduler_t, const __with_sched& __self) noexcept
+ -> _Scheduler
{
return __self.__sched_;
}
@@ -6234,23 +6338,26 @@
template <sender _Sender, scheduler _Scheduler,
__sender_adaptor_closure_for<_Sender> _Closure>
auto operator()(_Sender&& __sndr, _Scheduler&& __sched,
- _Closure&& __clsur) const
+ _Closure&& __clsur) const -> __well_formed_sender auto
{
auto __domain = __get_early_domain(__sndr);
return stdexec::transform_sender(
- __domain,
- __make_sexpr<continue_on_t>(
- __continue_on_data{(_Scheduler&&)__sched, (_Closure&&)__clsur},
- (_Sender&&)__sndr));
+ __domain, __make_sexpr<continue_on_t>(
+ __continue_on_data{static_cast<_Scheduler&&>(__sched),
+ static_cast<_Closure&&>(__clsur)},
+ static_cast<_Sender&&>(__sndr)));
}
template <scheduler _Scheduler, __sender_adaptor_closure _Closure>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
auto operator()(_Scheduler&& __sched, _Closure&& __clsur) const
-> __binder_back<continue_on_t, __decay_t<_Scheduler>,
__decay_t<_Closure>>
{
- return {{}, {}, {(_Scheduler&&)__sched, (_Closure&&)__clsur}};
+ return {{},
+ {},
+ {static_cast<_Scheduler&&>(__sched),
+ static_cast<_Closure&&>(__clsur)}};
}
using __no_scheduler_in_environment::transform_sender;
@@ -6260,17 +6367,17 @@
static auto transform_sender(_Sender&& __sndr, const _Env& __env)
{
auto __old = get_scheduler(__env);
- return __sexpr_apply((_Sender&&)__sndr,
+ return __sexpr_apply(static_cast<_Sender&&>(__sndr),
[&]<class _Data, class _Child>(
__ignore, _Data&& __data, _Child&& __child) {
- auto&& [__sched, __clsur] = (_Data&&)__data;
+ auto&& [__sched, __clsur] = static_cast<_Data&&>(__data);
using _Closure = decltype(__clsur);
- return __write(
- transfer(((_Closure&&)__clsur)(transfer(
- __write((_Child&&)__child, __with_sched{__old}),
- __sched)),
- __old),
- __with_sched{__sched});
+ return __write(transfer(static_cast<_Closure&&>(__clsur)(transfer(
+ __write(static_cast<_Child&&>(__child),
+ __with_sched{__old}),
+ __sched)),
+ __old),
+ __with_sched{__sched});
});
}
};
@@ -6285,6 +6392,18 @@
inline constexpr continue_on_t continue_on{};
} // namespace v2
+template <>
+struct __sexpr_impl<v2::on_t> : __sexpr_defaults
+{
+ using is_dependent = void;
+};
+
+template <>
+struct __sexpr_impl<v2::continue_on_t> : __sexpr_defaults
+{
+ using is_dependent = void;
+};
+
/////////////////////////////////////////////////////////////////////////////
// [execution.senders.consumers.sync_wait]
// [execution.senders.consumers.sync_wait_with_variant]
@@ -6343,13 +6462,14 @@
void __set_error(_Error __err) noexcept
{
if constexpr (__decays_to<_Error, std::exception_ptr>)
- __state_->__data_.template emplace<2>((_Error&&)__err);
+ __state_->__data_.template emplace<2>(
+ static_cast<_Error&&>(__err));
else if constexpr (__decays_to<_Error, std::error_code>)
__state_->__data_.template emplace<2>(
std::make_exception_ptr(std::system_error(__err)));
else
__state_->__data_.template emplace<2>(
- std::make_exception_ptr((_Error&&)__err));
+ std::make_exception_ptr(static_cast<_Error&&>(__err)));
__loop_->finish();
}
@@ -6359,7 +6479,8 @@
{
try
{
- __rcvr.__state_->__data_.template emplace<1>((_As&&)__as...);
+ __rcvr.__state_->__data_.template emplace<1>(
+ static_cast<_As&&>(__as)...);
__rcvr.__loop_->finish();
}
catch (...)
@@ -6371,7 +6492,7 @@
template <same_as<set_error_t> _Tag, class _Error>
friend void tag_invoke(_Tag, __t&& __rcvr, _Error __err) noexcept
{
- __rcvr.__set_error((_Error&&)__err);
+ __rcvr.__set_error(static_cast<_Error&&>(__err));
}
friend void tag_invoke(set_stopped_t __d, __t&& __rcvr) noexcept
@@ -6380,7 +6501,7 @@
__rcvr.__loop_->finish();
}
- friend __env tag_invoke(get_env_t, const __t& __rcvr) noexcept
+ friend auto tag_invoke(get_env_t, const __t& __rcvr) noexcept -> __env
{
return __env(*__rcvr.__loop_);
}
@@ -6480,7 +6601,6 @@
constexpr __mstring __diag = "Unknown concept check failure."_mstr;
return __sync_wait_error<__diag, _Sender>();
}
- STDEXEC_UNREACHABLE();
}
template <class _Sender>
@@ -6500,7 +6620,8 @@
-> std::optional<__value_tuple_for_t<_Sender>>
{
auto __domain = __get_early_domain(__sndr);
- return stdexec::apply_sender(__domain, *this, (_Sender&&)__sndr);
+ return stdexec::apply_sender(__domain, *this,
+ static_cast<_Sender&&>(__sndr));
}
#if STDEXEC_NVHPC()
@@ -6531,7 +6652,7 @@
// Launch the sender with a continuation that will fill in a variant
// and notify a condition variable.
- auto __op_state = connect((_Sender&&)__sndr,
+ auto __op_state = connect(static_cast<_Sender&&>(__sndr),
__receiver_t<_Sender>{&__state, &__loop});
start(__op_state);
@@ -6561,7 +6682,8 @@
-> std::optional<__variant_for_t<_Sender>>
{
auto __domain = __get_early_domain(__sndr);
- return stdexec::apply_sender(__domain, *this, (_Sender&&)__sndr);
+ return stdexec::apply_sender(__domain, *this,
+ static_cast<_Sender&&>(__sndr));
}
#if STDEXEC_NVHPC()
@@ -6585,7 +6707,8 @@
auto apply_sender(_Sender&& __sndr) const
-> std::optional<__variant_for_t<_Sender>>
{
- if (auto __opt_values = sync_wait_t()(into_variant((_Sender&&)__sndr)))
+ if (auto __opt_values =
+ sync_wait_t()(into_variant(static_cast<_Sender&&>(__sndr))))
{
return std::move(std::get<0>(*__opt_values));
}
diff --git a/include/sdbusplus/async/stdexec/functional.hpp b/include/sdbusplus/async/stdexec/functional.hpp
index a19719c..3b4c989 100644
--- a/include/sdbusplus/async/stdexec/functional.hpp
+++ b/include/sdbusplus/async/stdexec/functional.hpp
@@ -32,7 +32,7 @@
template <class _Fun, class... _As>
concept invocable = //
requires(_Fun&& __f, _As&&... __as) {
- std::invoke((_Fun&&)__f, (_As&&)__as...);
+ std::invoke(static_cast<_Fun&&>(__f), static_cast<_As&&>(__as)...);
};
#endif
} // namespace stdexec::__std_concepts
@@ -40,7 +40,7 @@
namespace std
{
using namespace stdexec::__std_concepts;
-}
+} // namespace std
namespace stdexec
{
@@ -51,13 +51,11 @@
template <class... _Args>
requires __callable<_FunT, _Args...>
- STDEXEC_ATTRIBUTE((always_inline)) //
- auto
- operator()(_Args&&... __args) const
- noexcept(noexcept(_Fun((_Args&&)__args...)))
- -> decltype(_Fun((_Args&&)__args...))
+ STDEXEC_ATTRIBUTE((always_inline)) auto operator()(_Args&&... __args) const
+ noexcept(noexcept(_Fun(static_cast<_Args&&>(__args)...)))
+ -> decltype(_Fun(static_cast<_Args&&>(__args)...))
{
- return _Fun((_Args&&)__args...);
+ return _Fun(static_cast<_Args&&>(__args)...);
}
};
@@ -67,13 +65,12 @@
using _FunT = _Ty _Cl::*;
template <class _Arg>
- requires requires(_Arg&& __arg) { ((_Arg&&)__arg).*_MemPtr; }
- STDEXEC_ATTRIBUTE((always_inline)) //
- constexpr auto
+ requires requires(_Arg&& __arg) { static_cast<_Arg&&>(__arg).*_MemPtr; }
+ STDEXEC_ATTRIBUTE((always_inline)) constexpr auto
operator()(_Arg&& __arg) const noexcept
- -> decltype((((_Arg&&)__arg).*_MemPtr))
+ -> decltype(((static_cast<_Arg&&>(__arg)).*_MemPtr))
{
- return ((_Arg&&)__arg).*_MemPtr;
+ return static_cast<_Arg&&>(__arg).*_MemPtr;
}
};
@@ -83,37 +80,40 @@
template <class _Fun0, class _Fun1>
struct __composed
{
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fun0 __t0_;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fun1 __t1_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fun0 __t0_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fun1 __t1_;
template <class... _Ts>
requires __callable<_Fun1, _Ts...> &&
__callable<_Fun0, __call_result_t<_Fun1, _Ts...>>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__call_result_t<_Fun0, __call_result_t<_Fun1, _Ts...>>
operator()(_Ts&&... __ts) &&
{
- return ((_Fun0&&)__t0_)(((_Fun1&&)__t1_)((_Ts&&)__ts...));
+ return static_cast<_Fun0&&>(__t0_)(
+ static_cast<_Fun1&&>(__t1_)(static_cast<_Ts&&>(__ts)...));
}
template <class... _Ts>
requires __callable<const _Fun1&, _Ts...> &&
__callable<const _Fun0&, __call_result_t<const _Fun1&, _Ts...>>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__call_result_t<_Fun0, __call_result_t<_Fun1, _Ts...>>
operator()(_Ts&&... __ts) const&
{
- return __t0_(__t1_((_Ts&&)__ts...));
+ return __t0_(__t1_(static_cast<_Ts&&>(__ts)...));
}
};
inline constexpr struct __compose_t
{
template <class _Fun0, class _Fun1>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__composed<_Fun0, _Fun1> operator()(_Fun0 __fun0, _Fun1 __fun1) const
{
- return {(_Fun0&&)__fun0, (_Fun1&&)__fun1};
+ return {static_cast<_Fun0&&>(__fun0), static_cast<_Fun1&&>(__fun1)};
}
} __compose{};
@@ -127,70 +127,79 @@
struct __funobj
{
template <class _Fun, class... _Args>
- STDEXEC_ATTRIBUTE((always_inline)) //
- constexpr auto operator()(_Fun&& __fun, _Args&&... __args) const
- noexcept(noexcept(((_Fun&&)__fun)((_Args&&)__args...)))
- -> decltype(((_Fun&&)__fun)((_Args&&)__args...))
+ STDEXEC_ATTRIBUTE((always_inline))
+ constexpr auto operator()(_Fun&& __fun, _Args&&... __args) const noexcept(
+ noexcept((static_cast<_Fun&&>(__fun))(static_cast<_Args&&>(__args)...)))
+ -> decltype((static_cast<_Fun&&>(__fun))(
+ static_cast<_Args&&>(__args)...))
{
- return ((_Fun&&)__fun)((_Args&&)__args...);
+ return static_cast<_Fun&&>(__fun)(static_cast<_Args&&>(__args)...);
}
};
struct __memfn
{
template <class _Memptr, class _Ty, class... _Args>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Memptr __mem_ptr, _Ty&& __ty,
_Args&&... __args) const
- noexcept(noexcept((((_Ty&&)__ty).*__mem_ptr)((_Args&&)__args...)))
- -> decltype((((_Ty&&)__ty).*__mem_ptr)((_Args&&)__args...))
+ noexcept(noexcept(((static_cast<_Ty&&>(__ty)).*
+ __mem_ptr)(static_cast<_Args&&>(__args)...)))
+ -> decltype(((static_cast<_Ty&&>(__ty)).*
+ __mem_ptr)(static_cast<_Args&&>(__args)...))
{
- return (((_Ty&&)__ty).*__mem_ptr)((_Args&&)__args...);
+ return ((static_cast<_Ty&&>(__ty)).*
+ __mem_ptr)(static_cast<_Args&&>(__args)...);
}
};
struct __memfn_refwrap
{
template <class _Memptr, class _Ty, class... _Args>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Memptr __mem_ptr, _Ty __ty,
_Args&&... __args) const
- noexcept(noexcept((__ty.get().*__mem_ptr)((_Args&&)__args...)))
- -> decltype((__ty.get().*__mem_ptr)((_Args&&)__args...))
+ noexcept(noexcept((__ty.get().*
+ __mem_ptr)(static_cast<_Args&&>(__args)...)))
+ -> decltype((__ty.get().*
+ __mem_ptr)(static_cast<_Args&&>(__args)...))
{
- return (__ty.get().*__mem_ptr)((_Args&&)__args...);
+ return (__ty.get().*__mem_ptr)(static_cast<_Args&&>(__args)...);
}
};
struct __memfn_smartptr
{
template <class _Memptr, class _Ty, class... _Args>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Memptr __mem_ptr, _Ty&& __ty,
_Args&&... __args) const
- noexcept(noexcept(((*(_Ty&&)__ty).*__mem_ptr)((_Args&&)__args...)))
- -> decltype(((*(_Ty&&)__ty).*__mem_ptr)((_Args&&)__args...))
+ noexcept(noexcept(((*static_cast<_Ty&&>(__ty)).*
+ __mem_ptr)(static_cast<_Args&&>(__args)...)))
+ -> decltype(((*static_cast<_Ty&&>(__ty)).*
+ __mem_ptr)(static_cast<_Args&&>(__args)...))
{
- return ((*(_Ty&&)__ty).*__mem_ptr)((_Args&&)__args...);
+ return ((*static_cast<_Ty&&>(__ty)).*
+ __mem_ptr)(static_cast<_Args&&>(__args)...);
}
};
struct __memobj
{
template <class _Mbr, class _Class, class _Ty>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Mbr _Class::*__mem_ptr,
_Ty&& __ty) const noexcept
- -> decltype((((_Ty&&)__ty).*__mem_ptr))
+ -> decltype(((static_cast<_Ty&&>(__ty)).*__mem_ptr))
{
- return (((_Ty&&)__ty).*__mem_ptr);
+ return ((static_cast<_Ty&&>(__ty)).*__mem_ptr);
}
};
struct __memobj_refwrap
{
template <class _Mbr, class _Class, class _Ty>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Mbr _Class::*__mem_ptr, _Ty __ty) const noexcept
-> decltype((__ty.get().*__mem_ptr))
{
@@ -201,16 +210,16 @@
struct __memobj_smartptr
{
template <class _Mbr, class _Class, class _Ty>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Mbr _Class::*__mem_ptr,
_Ty&& __ty) const noexcept
- -> decltype(((*(_Ty&&)__ty).*__mem_ptr))
+ -> decltype(((*static_cast<_Ty&&>(__ty)).*__mem_ptr))
{
- return ((*(_Ty&&)__ty).*__mem_ptr);
+ return ((*static_cast<_Ty&&>(__ty)).*__mem_ptr);
}
};
-__funobj __invoke_selector(__ignore, __ignore) noexcept;
+auto __invoke_selector(__ignore, __ignore) noexcept -> __funobj;
template <class _Mbr, class _Class, class _Ty>
auto __invoke_selector(_Mbr _Class::*, const _Ty&) noexcept
@@ -252,25 +261,27 @@
struct __invoke_t
{
template <class _Fun>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Fun&& __fun) const
- noexcept(noexcept(((_Fun&&)__fun)())) -> decltype(((_Fun&&)__fun)())
+ noexcept(noexcept((static_cast<_Fun&&>(__fun))()))
+ -> decltype((static_cast<_Fun&&>(__fun))())
{
- return ((_Fun&&)__fun)();
+ return static_cast<_Fun&&>(__fun)();
}
template <class _Fun, class _Ty, class... _Args>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
constexpr auto operator()(_Fun&& __fun, _Ty&& __ty, _Args&&... __args) const
- noexcept(noexcept(__invoke_selector(__fun, __ty)((_Fun&&)__fun,
- (_Ty&&)__ty,
- (_Args&&)__args...)))
- -> decltype(__invoke_selector(__fun, __ty)((_Fun&&)__fun,
- (_Ty&&)__ty,
- (_Args&&)__args...))
+ noexcept(noexcept(__invoke_selector(__fun, __ty)(
+ static_cast<_Fun&&>(__fun), static_cast<_Ty&&>(__ty),
+ static_cast<_Args&&>(__args)...)))
+ -> decltype(__invoke_selector(__fun, __ty)(
+ static_cast<_Fun&&>(__fun), static_cast<_Ty&&>(__ty),
+ static_cast<_Args&&>(__args)...))
{
return decltype(__invoke_selector(__fun, __ty))()(
- (_Fun&&)__fun, (_Ty&&)__ty, (_Args&&)__args...);
+ static_cast<_Fun&&>(__fun), static_cast<_Ty&&>(__ty),
+ static_cast<_Args&&>(__args)...);
}
};
} // namespace __invoke_
@@ -280,7 +291,7 @@
template <class _Fun, class... _As>
concept __invocable = //
requires(_Fun&& __f, _As&&... __as) {
- __invoke((_Fun&&)__f, (_As&&)__as...);
+ __invoke(static_cast<_Fun&&>(__f), static_cast<_As&&>(__as)...);
};
template <class _Fun, class... _As>
@@ -288,7 +299,7 @@
__invocable<_Fun, _As...> && //
requires(_Fun&& __f, _As&&... __as) {
{
- __invoke((_Fun&&)__f, (_As&&)__as...)
+ __invoke(static_cast<_Fun&&>(__f), static_cast<_As&&>(__as)...)
} noexcept;
};
@@ -301,12 +312,15 @@
using std::get;
template <std::size_t... _Is, class _Fn, class _Tup>
-STDEXEC_ATTRIBUTE((always_inline)) //
+STDEXEC_ATTRIBUTE((always_inline))
constexpr auto __impl(__indices<_Is...>, _Fn&& __fn, _Tup&& __tup) noexcept(
- noexcept(__invoke((_Fn&&)__fn, get<_Is>((_Tup&&)__tup)...)))
- -> decltype(__invoke((_Fn&&)__fn, get<_Is>((_Tup&&)__tup)...))
+ noexcept(__invoke(static_cast<_Fn&&>(__fn),
+ get<_Is>(static_cast<_Tup&&>(__tup))...)))
+ -> decltype(__invoke(static_cast<_Fn&&>(__fn),
+ get<_Is>(static_cast<_Tup&&>(__tup))...))
{
- return __invoke((_Fn&&)__fn, get<_Is>((_Tup&&)__tup)...);
+ return __invoke(static_cast<_Fn&&>(__fn),
+ get<_Is>(static_cast<_Tup&&>(__tup))...);
}
template <class _Tup>
@@ -334,13 +348,13 @@
{
template <class _Fn, class _Tup>
requires __applicable<_Fn, _Tup>
- STDEXEC_ATTRIBUTE((always_inline)) //
- constexpr auto
+ STDEXEC_ATTRIBUTE((always_inline)) constexpr auto
operator()(_Fn&& __fn, _Tup&& __tup) const
noexcept(__nothrow_applicable<_Fn, _Tup>) -> __apply_result_t<_Fn, _Tup>
{
- return __apply_::__impl(__apply_::__tuple_indices<_Tup>(), (_Fn&&)__fn,
- (_Tup&&)__tup);
+ return __apply_::__impl(__apply_::__tuple_indices<_Tup>(),
+ static_cast<_Fn&&>(__fn),
+ static_cast<_Tup&&>(__tup));
}
};
@@ -349,7 +363,7 @@
template <class _Tag, class _Ty>
struct __field
{
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
_Ty operator()(_Tag) const noexcept(__nothrow_decay_copyable<const _Ty&>)
{
return __t_;
@@ -362,11 +376,11 @@
struct __mkfield_
{
template <class _Ty>
- STDEXEC_ATTRIBUTE((always_inline)) //
+ STDEXEC_ATTRIBUTE((always_inline))
__field<_Tag, __decay_t<_Ty>> operator()(_Ty&& __ty) const
noexcept(__nothrow_decay_copyable<_Ty>)
{
- return {(_Ty&&)__ty};
+ return {static_cast<_Ty&&>(__ty)};
}
};
@@ -384,14 +398,15 @@
template <class _Tag, class... _Args>
concept tag_invocable = //
requires(_Tag __tag, _Args&&... __args) {
- tag_invoke((_Tag&&)__tag, (_Args&&)__args...);
+ tag_invoke(static_cast<_Tag&&>(__tag), static_cast<_Args&&>(__args)...);
};
template <class _Ret, class _Tag, class... _Args>
concept __tag_invocable_r = //
requires(_Tag __tag, _Args&&... __args) {
{
- static_cast<_Ret>(tag_invoke((_Tag&&)__tag, (_Args&&)__args...))
+ static_cast<_Ret>(tag_invoke(static_cast<_Tag&&>(__tag),
+ static_cast<_Args&&>(__args)...))
};
};
@@ -401,7 +416,8 @@
tag_invocable<_Tag, _Args...> && //
requires(_Tag __tag, _Args&&... __args) {
{
- tag_invoke((_Tag&&)__tag, (_Args&&)__args...)
+ tag_invoke(static_cast<_Tag&&>(__tag),
+ static_cast<_Args&&>(__args)...)
} noexcept;
};
@@ -429,7 +445,8 @@
noexcept(nothrow_tag_invocable<_Tag, _Args...>)
-> tag_invoke_result_t<_Tag, _Args...>
{
- return tag_invoke((_Tag&&)__tag, (_Args&&)__args...);
+ return tag_invoke(static_cast<_Tag&&>(__tag),
+ static_cast<_Args&&>(__args)...);
}
};
@@ -440,7 +457,7 @@
namespace __ti
{
inline constexpr tag_invoke_t tag_invoke{};
-}
+} // namespace __ti
using namespace __ti;
diff --git a/include/sdbusplus/async/stdexec/sequence_senders.hpp b/include/sdbusplus/async/stdexec/sequence_senders.hpp
index c579998..ee40ae4 100644
--- a/include/sdbusplus/async/stdexec/sequence_senders.hpp
+++ b/include/sdbusplus/async/stdexec/sequence_senders.hpp
@@ -72,7 +72,7 @@
next_sender<tag_invoke_result_t<set_next_t, _Receiver&, _Item>>,
"The sender returned from set_next is required to complete with set_value_t() or "
"set_stopped_t()");
- return tag_invoke(*this, __rcvr, (_Item&&)__item);
+ return tag_invoke(*this, __rcvr, static_cast<_Item&&>(__item));
}
};
} // namespace __sequence_sndr
@@ -97,11 +97,12 @@
using __id = __stopped_means_break;
using _Receiver = stdexec::__t<_ReceiverId>;
using _Token = stop_token_of_t<env_of_t<_Receiver>>;
- STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Receiver __rcvr_;
template <same_as<get_env_t> _GetEnv, same_as<__t> _Self>
- friend env_of_t<_Receiver> tag_invoke(_GetEnv,
- const _Self& __self) noexcept
+ friend auto tag_invoke(_GetEnv, const _Self& __self) noexcept
+ -> env_of_t<_Receiver>
{
return stdexec::get_env(__self.__rcvr_);
}
@@ -195,19 +196,19 @@
{
using _Result =
tag_invoke_result_t<get_item_types_t, _TfxSender, _Env>;
- return (_Result(*)()) nullptr;
+ return static_cast<_Result (*)()>(nullptr);
}
else if constexpr (__with_member_alias<_TfxSender, _Env>)
{
using _Result = __member_alias_t<_TfxSender, _Env>;
- return (_Result(*)()) nullptr;
+ return static_cast<_Result (*)()>(nullptr);
}
else if constexpr (sender_in<_TfxSender, _Env> &&
!enable_sequence_sender<
stdexec::__decay_t<_TfxSender>>)
{
using _Result = item_types<stdexec::__decay_t<_TfxSender>>;
- return (_Result(*)()) nullptr;
+ return static_cast<_Result (*)()>(nullptr);
}
else if constexpr (__is_debug_env<_Env>)
{
@@ -217,14 +218,14 @@
using _Completions [[maybe_unused]] =
tag_invoke_result_t<get_item_types_t,
__tfx_sender<_Sender, _Env>, _Env>;
- return (__debug::__completion_signatures(*)()) nullptr;
+ return static_cast<__debug::__completion_signatures (*)()>(nullptr);
}
else
{
using _Result =
__mexception<_UNRECOGNIZED_SENDER_TYPE_<>,
_WITH_SENDER_<_Sender>, _WITH_ENVIRONMENT_<_Env>>;
- return (_Result(*)()) nullptr;
+ return static_cast<_Result (*)()>(nullptr);
}
}
@@ -252,7 +253,8 @@
template <class _Sender, class _Env>
concept has_sequence_item_types =
requires(_Sender&& __sndr, _Env&& __env) {
- get_item_types((_Sender&&)__sndr, (_Env&&)__env);
+ get_item_types(static_cast<_Sender&&>(__sndr),
+ static_cast<_Env&&>(__env));
};
template <class _Sender, class _Env>
@@ -276,12 +278,12 @@
template <class _Receiver, class _Item>
requires stdexec::__callable<set_next_t, _Receiver&, _Item>
-stdexec::__msuccess __try_item(_Item*);
+auto __try_item(_Item*) -> stdexec::__msuccess;
template <class _Receiver, class... _Items>
auto __try_items(exec::item_types<_Items...>*)
-> decltype((stdexec::__msuccess(), ...,
- exec::__try_item<_Receiver>((_Items*)nullptr)));
+ exec::__try_item<_Receiver>(static_cast<_Items*>(nullptr))));
template <class _Receiver, class _Items>
concept __sequence_receiver_of =
@@ -448,11 +450,13 @@
"stdexec::connect(sender, receiver) must return a type that "
"satisfies the operation_state concept");
next_sender_of_t<_Receiver, _TfxSender> __next = set_next(
- __rcvr, transform_sender(__domain, (_Sender&&)__sndr, __env));
+ __rcvr, transform_sender(
+ __domain, static_cast<_Sender&&>(__sndr), __env));
return tag_invoke(
connect_t{},
static_cast<next_sender_of_t<_Receiver, _TfxSender>&&>(__next),
- __stopped_means_break_t<_Receiver>{(_Receiver&&)__rcvr});
+ __stopped_means_break_t<_Receiver>{
+ static_cast<_Receiver&&>(__rcvr)});
}
else if constexpr (__subscribeable_with_tag_invoke<_TfxSender,
_Receiver>)
@@ -462,10 +466,11 @@
tag_invoke_result_t<subscribe_t, _TfxSender, _Receiver>>,
"exec::subscribe(sender, receiver) must return a type that "
"satisfies the operation_state concept");
- return tag_invoke(
- subscribe_t{},
- transform_sender(__domain, (_Sender&&)__sndr, __env),
- (_Receiver&&)__rcvr);
+ return tag_invoke(subscribe_t{},
+ transform_sender(__domain,
+ static_cast<_Sender&&>(__sndr),
+ __env),
+ static_cast<_Receiver&&>(__rcvr));
}
else if constexpr (enable_sequence_sender<
stdexec::__decay_t<_TfxSender>>)
@@ -474,21 +479,25 @@
// useful debugging information.
using __tag_invoke::tag_invoke;
tag_invoke(*this,
- transform_sender(__domain, (_Sender&&)__sndr, __env),
- (_Receiver&&)__rcvr);
+ transform_sender(__domain,
+ static_cast<_Sender&&>(__sndr), __env),
+ static_cast<_Receiver&&>(__rcvr));
}
else
{
next_sender_of_t<_Receiver, _TfxSender> __next = set_next(
- __rcvr, transform_sender(__domain, (_Sender&&)__sndr, __env));
+ __rcvr, transform_sender(
+ __domain, static_cast<_Sender&&>(__sndr), __env));
return tag_invoke(
connect_t{},
static_cast<next_sender_of_t<_Receiver, _TfxSender>&&>(__next),
- __stopped_means_break_t<_Receiver>{(_Receiver&&)__rcvr});
+ __stopped_means_break_t<_Receiver>{
+ static_cast<_Receiver&&>(__rcvr)});
}
}
- friend constexpr bool tag_invoke(forwarding_query_t, subscribe_t) noexcept
+ friend constexpr auto tag_invoke(forwarding_query_t, subscribe_t) noexcept
+ -> bool
{
return false;
}
@@ -506,13 +515,13 @@
using __sequence_sndr::subscribe_result_t;
template <class _Sender, class _Receiver>
-concept sequence_sender_to =
- sequence_receiver_from<_Receiver, _Sender> && //
- requires(_Sender&& __sndr, _Receiver&& __rcvr) {
- {
- subscribe((_Sender&&)__sndr, (_Receiver&&)__rcvr)
- };
- };
+concept sequence_sender_to = sequence_receiver_from<_Receiver, _Sender> && //
+ requires(_Sender&& __sndr, _Receiver&& __rcvr) {
+ {
+ subscribe(static_cast<_Sender&&>(__sndr),
+ static_cast<_Receiver&&>(__rcvr))
+ };
+ };
template <class _Receiver>
concept __stoppable_receiver = //
diff --git a/include/sdbusplus/async/stdexec/stop_token.hpp b/include/sdbusplus/async/stdexec/stop_token.hpp
index 9efd84e..6c00940 100644
--- a/include/sdbusplus/async/stdexec/stop_token.hpp
+++ b/include/sdbusplus/async/stdexec/stop_token.hpp
@@ -114,17 +114,17 @@
template <class>
using callback_type = __callback_type;
- static constexpr bool stop_requested() noexcept
+ static constexpr auto stop_requested() noexcept -> bool
{
return false;
}
- static constexpr bool stop_possible() noexcept
+ static constexpr auto stop_possible() noexcept -> bool
{
return false;
}
- bool operator==(const never_stop_token&) const noexcept = default;
+ auto operator==(const never_stop_token&) const noexcept -> bool = default;
};
template <class _Callback>
@@ -138,11 +138,11 @@
~in_place_stop_source();
in_place_stop_source(in_place_stop_source&&) = delete;
- in_place_stop_token get_token() const noexcept;
+ auto get_token() const noexcept -> in_place_stop_token;
- bool request_stop() noexcept;
+ auto request_stop() noexcept -> bool;
- bool stop_requested() const noexcept
+ auto stop_requested() const noexcept -> bool
{
return (__state_.load(std::memory_order_acquire) &
__stop_requested_flag_) != 0;
@@ -154,13 +154,13 @@
template <class>
friend class in_place_stop_callback;
- uint8_t __lock_() const noexcept;
+ auto __lock_() const noexcept -> uint8_t;
void __unlock_(uint8_t) const noexcept;
- bool __try_lock_unless_stop_requested_(bool) const noexcept;
+ auto __try_lock_unless_stop_requested_(bool) const noexcept -> bool;
- bool __try_add_callback_(
- __stok::__in_place_stop_callback_base*) const noexcept;
+ auto __try_add_callback_(
+ __stok::__in_place_stop_callback_base*) const noexcept -> bool;
void __remove_callback_(
__stok::__in_place_stop_callback_base*) const noexcept;
@@ -188,21 +188,22 @@
__source_(std::exchange(__other.__source_, {}))
{}
- in_place_stop_token&
- operator=(const in_place_stop_token& __other) noexcept = default;
+ auto operator=(const in_place_stop_token& __other) noexcept
+ -> in_place_stop_token& = default;
- in_place_stop_token& operator=(in_place_stop_token&& __other) noexcept
+ auto operator=(in_place_stop_token&& __other) noexcept
+ -> in_place_stop_token&
{
__source_ = std::exchange(__other.__source_, nullptr);
return *this;
}
- bool stop_requested() const noexcept
+ [[nodiscard]] auto stop_requested() const noexcept -> bool
{
return __source_ != nullptr && __source_->stop_requested();
}
- bool stop_possible() const noexcept
+ [[nodiscard]] auto stop_possible() const noexcept -> bool
{
return __source_ != nullptr;
}
@@ -212,7 +213,8 @@
std::swap(__source_, __other.__source_);
}
- bool operator==(const in_place_stop_token&) const noexcept = default;
+ auto operator==(const in_place_stop_token&) const noexcept
+ -> bool = default;
private:
friend in_place_stop_source;
@@ -227,7 +229,8 @@
const in_place_stop_source* __source_;
};
-inline in_place_stop_token in_place_stop_source::get_token() const noexcept
+inline auto in_place_stop_source::get_token() const noexcept
+ -> in_place_stop_token
{
return in_place_stop_token{this};
}
@@ -244,7 +247,7 @@
noexcept(__nothrow_constructible_from<_Fun, _Fun2>) :
__stok::__in_place_stop_callback_base(
__token.__source_, &in_place_stop_callback::__execute_impl_),
- __fun_((_Fun2&&)__fun)
+ __fun_(static_cast<_Fun2&&>(__fun))
{
__register_callback_();
}
@@ -262,7 +265,8 @@
std::move(static_cast<in_place_stop_callback*>(cb)->__fun_)();
}
- STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_;
+ STDEXEC_ATTRIBUTE((no_unique_address))
+ _Fun __fun_;
};
namespace __stok
@@ -289,7 +293,7 @@
STDEXEC_ASSERT(__callbacks_ == nullptr);
}
-inline bool in_place_stop_source::request_stop() noexcept
+inline auto in_place_stop_source::request_stop() noexcept -> bool
{
if (!__try_lock_unless_stop_requested_(true))
return true;
@@ -326,7 +330,7 @@
return false;
}
-inline uint8_t in_place_stop_source::__lock_() const noexcept
+inline auto in_place_stop_source::__lock_() const noexcept -> uint8_t
{
__stok::__spin_wait __spin;
auto __old_state = __state_.load(std::memory_order_relaxed);
@@ -349,8 +353,8 @@
(void)__state_.store(__old_state, std::memory_order_release);
}
-inline bool in_place_stop_source::__try_lock_unless_stop_requested_(
- bool __set_stop_requested) const noexcept
+inline auto in_place_stop_source::__try_lock_unless_stop_requested_(
+ bool __set_stop_requested) const noexcept -> bool
{
__stok::__spin_wait __spin;
auto __old_state = __state_.load(std::memory_order_relaxed);
@@ -383,8 +387,8 @@
return true;
}
-inline bool in_place_stop_source::__try_add_callback_(
- __stok::__in_place_stop_callback_base* __callbk) const noexcept
+inline auto in_place_stop_source::__try_add_callback_(
+ __stok::__in_place_stop_callback_base* __callbk) const noexcept -> bool
{
if (!__try_lock_unless_stop_requested_(false))
{
diff --git a/include/sdbusplus/async/stdexec/task.hpp b/include/sdbusplus/async/stdexec/task.hpp
index 4eeb9ab..60f9e49 100644
--- a/include/sdbusplus/async/stdexec/task.hpp
+++ b/include/sdbusplus/async/stdexec/task.hpp
@@ -112,9 +112,9 @@
__scheduler_{exec::inline_scheduler{}};
in_place_stop_token __stop_token_;
- friend const __any_scheduler&
- tag_invoke(get_scheduler_t,
- const __default_task_context_impl& __self) noexcept
+ friend auto tag_invoke(get_scheduler_t,
+ const __default_task_context_impl& __self) noexcept
+ -> const __any_scheduler&
requires(__with_scheduler)
{
return __self.__scheduler_;
@@ -132,10 +132,10 @@
template <scheduler _Scheduler>
explicit __default_task_context_impl(_Scheduler&& __scheduler) :
- __scheduler_{(_Scheduler&&)__scheduler}
+ __scheduler_{static_cast<_Scheduler&&>(__scheduler)}
{}
- bool stop_requested() const noexcept
+ [[nodiscard]] auto stop_requested() const noexcept -> bool
{
return __stop_token_.stop_requested();
}
@@ -144,7 +144,7 @@
void set_scheduler(_Scheduler&& __sched)
requires(__with_scheduler)
{
- __scheduler_ = (_Scheduler&&)__sched;
+ __scheduler_ = static_cast<_Scheduler&&>(__sched);
}
template <class _ThisPromise>
@@ -320,7 +320,7 @@
template <class _Ty>
struct __promise_base
{
- void return_value(_Ty value) noexcept
+ void return_value(_Ty value)
{
__data_.template emplace<1>(std::move(value));
}
@@ -334,7 +334,7 @@
struct __void
{};
- void return_void() noexcept
+ void return_void()
{
__data_.template emplace<1>(__void{});
}
@@ -358,9 +358,9 @@
};
template <scheduler _Scheduler>
- __wrap<_Scheduler> operator()(_Scheduler __sched) const noexcept
+ auto operator()(_Scheduler __sched) const noexcept -> __wrap<_Scheduler>
{
- return {(_Scheduler&&)__sched};
+ return {static_cast<_Scheduler&&>(__sched)};
}
};
@@ -389,13 +389,14 @@
private:
struct __final_awaitable
{
- static constexpr bool await_ready() noexcept
+ static constexpr auto await_ready() noexcept -> bool
{
return false;
}
- static __coro::coroutine_handle<>
+ static auto
await_suspend(__coro::coroutine_handle<__promise> __h) noexcept
+ -> __coro::coroutine_handle<>
{
return __h.promise().continuation().handle();
}
@@ -405,23 +406,23 @@
struct __promise : __promise_base<_Ty>, with_awaitable_senders<__promise>
{
- basic_task get_return_object() noexcept
+ auto get_return_object() noexcept -> basic_task
{
return basic_task(
__coro::coroutine_handle<__promise>::from_promise(*this));
}
- __coro::suspend_always initial_suspend() noexcept
+ auto initial_suspend() noexcept -> __coro::suspend_always
{
return {};
}
- __final_awaitable final_suspend() noexcept
+ auto final_suspend() noexcept -> __final_awaitable
{
return {};
}
- __task::disposition disposition() const noexcept
+ [[nodiscard]] auto disposition() const noexcept -> __task::disposition
{
return static_cast<__task::disposition>(this->__data_.index());
}
@@ -433,19 +434,21 @@
template <sender _Awaitable>
requires __scheduler_provider<_Context>
- decltype(auto) await_transform(_Awaitable&& __awaitable) noexcept
+ auto await_transform(_Awaitable&& __awaitable) noexcept
+ -> decltype(auto)
{
// TODO: If we have a complete-where-it-starts query then we can
// optimize this to avoid the reschedule
- return as_awaitable(
- transfer((_Awaitable&&)__awaitable, get_scheduler(__context_)),
- *this);
+ return as_awaitable(transfer(static_cast<_Awaitable&&>(__awaitable),
+ get_scheduler(__context_)),
+ *this);
}
template <class _Scheduler>
requires __scheduler_provider<_Context>
- decltype(auto) await_transform(
+ auto await_transform(
__reschedule_coroutine_on::__wrap<_Scheduler> __box) noexcept
+ -> decltype(auto)
{
if (!std::exchange(__rescheduled_, true))
{
@@ -467,17 +470,18 @@
}
template <class _Awaitable>
- decltype(auto) await_transform(_Awaitable&& __awaitable) noexcept
+ auto await_transform(_Awaitable&& __awaitable) noexcept
+ -> decltype(auto)
{
return with_awaitable_senders<__promise>::await_transform(
- (_Awaitable&&)__awaitable);
+ static_cast<_Awaitable&&>(__awaitable));
}
using __context_t =
typename _Context::template promise_context_t<__promise>;
- friend const __context_t& tag_invoke(get_env_t,
- const __promise& __self) noexcept
+ friend auto tag_invoke(get_env_t, const __promise& __self) noexcept
+ -> const __context_t&
{
return __self.__context_;
}
@@ -499,14 +503,15 @@
__coro_.destroy();
}
- static constexpr bool await_ready() noexcept
+ static constexpr auto await_ready() noexcept -> bool
{
return false;
}
template <class _ParentPromise2>
- __coro::coroutine_handle<> await_suspend(
+ auto await_suspend(
__coro::coroutine_handle<_ParentPromise2> __parent) noexcept
+ -> __coro::coroutine_handle<>
{
static_assert(__one_of<_ParentPromise, _ParentPromise2, void>);
__context_.emplace(__coro_.promise().__context_,
@@ -522,7 +527,7 @@
return __coro_;
}
- _Ty await_resume()
+ auto await_resume() -> _Ty
{
__context_.reset();
scope_guard __on_exit{
@@ -540,16 +545,17 @@
requires constructible_from<
awaiter_context_t<__promise, _ParentPromise>, __promise&,
_ParentPromise&>
- friend __task_awaitable<_ParentPromise> tag_invoke(as_awaitable_t,
- basic_task&& __self,
- _ParentPromise&) noexcept
+ friend auto tag_invoke(as_awaitable_t, basic_task&& __self,
+ _ParentPromise&) noexcept
+ -> __task_awaitable<_ParentPromise>
{
return __task_awaitable<_ParentPromise>{
std::exchange(__self.__coro_, {})};
}
// Make this task generally awaitable:
- friend __task_awaitable<> operator co_await(basic_task && __self) noexcept
+ friend auto operator co_await(basic_task&& __self) noexcept
+ -> __task_awaitable<>
requires __mvalid<awaiter_context_t, __promise>
{
return __task_awaitable<>{std::exchange(__self.__coro_, {})};