Skip to content

Commit

Permalink
rename STDEXEC_CUSTOM to STDEXEC_MEMFN_DECL
Browse files Browse the repository at this point in the history
  • Loading branch information
ericniebler committed Feb 7, 2024
1 parent a6bdc6b commit ee7d6cf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ IndentWrappedFunctionNames: true
InsertTrailingCommas: None
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
Macros: [ 'STDEXEC_CUSTOM(X)=X' ]
Macros: [ 'STDEXEC_MEMFN_DECL(X)=X' ]
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
PackConstructorInitializers: Never
Expand Down
7 changes: 3 additions & 4 deletions examples/algorithms/then.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,18 @@ struct _then_sender {
_set_value_t>;

template <class Env>
STDEXEC_CUSTOM(auto get_completion_signatures)(this _then_sender&&, Env) -> _completions_t<Env> {
STDEXEC_MEMFN_DECL(auto get_completion_signatures)(this _then_sender&&, Env) -> _completions_t<Env> {
return {};
}

// Connect:
template <class R>
STDEXEC_CUSTOM(auto connect)(this _then_sender&& self, R r)
STDEXEC_MEMFN_DECL(auto connect)(this _then_sender&& self, R r)
-> stdexec::connect_result_t<S, _then_receiver<R, F>> {
return stdexec::connect((S&&) self.s_, _then_receiver<R, F>{(R&&) r, (F&&) self.f_});
}

STDEXEC_CUSTOM(auto get_env)(this const _then_sender& self) //
noexcept(noexcept(stdexec::get_env(self.s_))) -> std::invoke_result_t<stdexec::get_env_t, S> {
STDEXEC_MEMFN_DECL(auto get_env)(this const _then_sender& self) noexcept -> stdexec::env_of_t<S> {
return stdexec::get_env(self.s_);
}
};
Expand Down
20 changes: 18 additions & 2 deletions include/stdexec/__detail/__cpo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
/// Then define a member function like this:
///
/// @code
/// STDEXEC_CUSTOM(auto get_env)(this const MySender& self) {
/// STDEXEC_MEMFN_DECL(auto get_env)(this const MySender& self) {
/// return ...;
/// }
/// @endcode
#define STDEXEC_CUSTOM(...) \
#define STDEXEC_MEMFN_DECL(...) \
friend STDEXEC_TAG_INVOKE(STDEXEC_IS_AUTO(__VA_ARGS__), __VA_ARGS__) STDEXEC_TAG_INVOKE_ARGS

#define STDEXEC_TAG_INVOKE(_ISAUTO, ...) \
Expand All @@ -64,6 +64,22 @@
#define STDEXEC_TAG_INVOKE_ARGS(...) \
__VA_OPT__(,) STDEXEC_CAT(STDEXEC_EAT_THIS_, __VA_ARGS__))

#if STDEXEC_MSVC()
#pragma deprecated(STDEXEC_CUSTOM)
#endif

#if STDEXEC_GCC()
#define STDEXEC_CUSTOM \
_Pragma("GCC warning \"STDEXEC_CUSTOM is deprecated; use STDEXEC_MEMFN_DECL instead.\"") \
STDEXEC_MEMFN_DECL
#else
#define STDEXEC_CUSTOM STDEXEC_MEMFN_DECL
#endif

#if STDEXEC_CLANG()
#pragma clang deprecated (STDEXEC_CUSTOM, "use STDEXEC_MEMFN_DECL instead.")
#endif

namespace stdexec {
template <class>
struct __arg_type;
Expand Down

0 comments on commit ee7d6cf

Please sign in to comment.