add method::has_next, and have macros delegate to it

This commit is contained in:
Jean-Louis Leroy
2025-05-26 15:19:55 -04:00
committed by Jean-Louis Leroy
parent 2f9734b403
commit efc8cbff52
2 changed files with 13 additions and 3 deletions

View File

@@ -1046,6 +1046,9 @@ class method<Name, auto(Parameters...)->ReturnType, Registry>
template<auto>
static function_type next;
template<auto>
static bool has_next();
static BOOST_NORETURN auto
not_implemented_handler(detail::remove_virtual<Parameters>... args)
-> ReturnType;
@@ -1354,6 +1357,14 @@ auto error_type_id(const Class& obj) {
} // namespace detail
template<
typename Name, typename... Parameters, typename ReturnType, class Registry>
template<auto Fn>
inline auto method<Name, auto(Parameters...)->ReturnType, Registry>::has_next()
-> bool {
return next<Fn> != not_implemented_handler;
}
template<
typename Name, typename... Parameters, typename ReturnType, class Registry>
BOOST_NORETURN auto method<Name, auto(Parameters...)->ReturnType, Registry>::

View File

@@ -115,9 +115,8 @@ struct va_args<ReturnType> {
}; \
inline auto BOOST_OPENMETHOD_OVERRIDERS( \
NAME)<__VA_ARGS__ ARGS>::has_next() -> bool { \
using method_type = \
boost_openmethod_detail_locate_method_aux<void ARGS>::type; \
return method_type::next<fn> != method_type::not_implemented_handler; \
return boost_openmethod_detail_locate_method_aux< \
void ARGS>::type::has_next<fn>(); \
} \
template<typename... Args> \
inline auto BOOST_OPENMETHOD_OVERRIDERS(NAME)<__VA_ARGS__ ARGS>::next( \