-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
The current example of weak dispatch is just a "not implemented". However, to make a more useful default implementation, it is very common to access self, so that we can implement a weak dispatch with other non-weak dispatches.
I have found this is possible by manually defining the dispatch as
struct dispatch_name : existing_dispatch {
using existing_dispatch::operator();
template <class Self, class... Args>
decltype(auto) operator()(Self&& self, Args&&... args)
noexcept(noexcept(default_func_name(std::forward<Self>(self), std::forward<Args>(args)...)))
requires(requires { default_func_name(std::forward<Self>(self), std::forward<Args>(args)...); } and not std::same_as<Self, std::nullptr_t>) {
return default_func_name(std::forward<Self>(self), std::forward<Args>(args)...);
}
};But it might be worth adding a new helper macro for this, what do you think about it?
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested