diff --git a/include/yorel/yomm2/macros.hpp b/include/yorel/yomm2/macros.hpp index f582ea24..0f1fc6fb 100644 --- a/include/yorel/yomm2/macros.hpp +++ b/include/yorel/yomm2/macros.hpp @@ -23,27 +23,20 @@ ::yorel::yomm2::detail::remove_virtual>( \ BOOST_PP_CAT(a, I)) -#define yOMM2_RLIST(N, I, A) \ - BOOST_PP_COMMA_IF(I) \ - BOOST_PP_CAT(a, I) - -#define yOMM2_WHEN_STATIC(CODE1, CODE2) CODE1 -#define yOMM2_WHEN_NOT_STATIC(CODE1, CODE2) CODE2 +#define yOMM2_RLIST(N, I, A) BOOST_PP_COMMA_IF(I) BOOST_PP_CAT(a, I) #define YOMM2_METHOD(NAME, ARGS, ...) \ - YOREL_YOMM2_DETAIL_DECLARE(yOMM2_WHEN_NOT_STATIC, NAME, ARGS, __VA_ARGS__) + YOREL_YOMM2_DETAIL_DECLARE(, NAME, ARGS, __VA_ARGS__) #define YOMM2_STATIC_METHOD(NAME, ARGS, ...) \ - YOREL_YOMM2_DETAIL_DECLARE(yOMM2_WHEN_STATIC, NAME, ARGS, __VA_ARGS__) + YOREL_YOMM2_DETAIL_DECLARE(static, NAME, ARGS, __VA_ARGS__) -#define YOREL_YOMM2_DETAIL_DECLARE(IF_STATIC, NAME, ARGS, ...) \ +#define YOREL_YOMM2_DETAIL_DECLARE(STATIC, NAME, ARGS, ...) \ struct YOMM2_METHOD_NAME(NAME); \ - IF_STATIC(static, ) \ - ::yorel::yomm2::method \ + STATIC ::yorel::yomm2::method \ BOOST_PP_CAT(YOMM2_METHOD_NAME(NAME), guide_)( \ BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE(ARGS), yOMM2_PLIST, ARGS)); \ - IF_STATIC(static, ) \ - inline decltype(auto) NAME( \ + STATIC inline decltype(auto) NAME( \ BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE(ARGS), yOMM2_PLIST, ARGS)) { \ return ::yorel::yomm2:: \ method::fn( \ @@ -56,7 +49,7 @@ struct yorel_yomm2_detail_locate_method_aux; \ template \ struct yorel_yomm2_detail_locate_method_aux { \ - using type = decltype(NAME##guide_(std::declval()...)); \ + using type = decltype(NAME##guide_(std::declval()...)); \ }; \ using method_type = yorel_yomm2_detail_locate_method_aux::type;