From efc8cbff521a9367ae30189e8b0e5ee62152d19f Mon Sep 17 00:00:00 2001 From: Jean-Louis Leroy Date: Mon, 26 May 2025 15:19:55 -0400 Subject: [PATCH] add method::has_next, and have macros delegate to it --- include/boost/openmethod/core.hpp | 11 +++++++++++ include/boost/openmethod/macros.hpp | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/boost/openmethod/core.hpp b/include/boost/openmethod/core.hpp index f6bbbb6..d364b11 100644 --- a/include/boost/openmethod/core.hpp +++ b/include/boost/openmethod/core.hpp @@ -1046,6 +1046,9 @@ class methodReturnType, Registry> template static function_type next; + template + static bool has_next(); + static BOOST_NORETURN auto not_implemented_handler(detail::remove_virtual... 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 +inline auto methodReturnType, Registry>::has_next() + -> bool { + return next != not_implemented_handler; +} + template< typename Name, typename... Parameters, typename ReturnType, class Registry> BOOST_NORETURN auto methodReturnType, Registry>:: diff --git a/include/boost/openmethod/macros.hpp b/include/boost/openmethod/macros.hpp index 316f21c..26ad774 100644 --- a/include/boost/openmethod/macros.hpp +++ b/include/boost/openmethod/macros.hpp @@ -115,9 +115,8 @@ struct va_args { }; \ inline auto BOOST_OPENMETHOD_OVERRIDERS( \ NAME)<__VA_ARGS__ ARGS>::has_next() -> bool { \ - using method_type = \ - boost_openmethod_detail_locate_method_aux::type; \ - return method_type::next != method_type::not_implemented_handler; \ + return boost_openmethod_detail_locate_method_aux< \ + void ARGS>::type::has_next(); \ } \ template \ inline auto BOOST_OPENMETHOD_OVERRIDERS(NAME)<__VA_ARGS__ ARGS>::next( \