Skip to content

Commit

Permalink
more macro work
Browse files Browse the repository at this point in the history
  • Loading branch information
jll63 committed Sep 21, 2024
1 parent c87e03f commit 6b1c234
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions include/yorel/yomm2/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
#define yOMM2_WHEN_STATIC(CODE1, CODE2) CODE1
#define yOMM2_WHEN_NOT_STATIC(CODE1, CODE2) CODE2

#define yOMM2_OPEN_BRACE {
#define yOMM2_CLOSE_BRACE }

#define yOMM2_SELECTOR(NAME) NAME##_yOMM2_selector_

// Find method given the arguments. We cannot detect if __VAR_ARGS__ is empty,
// so we cannot express the 'method<...>' type directly. Instead, we wrap
// __VAR_ARGS__ in 'types<...>' and use 'method_va_args_first' find the method.
Expand All @@ -58,7 +53,7 @@
#define yOMM2_DECLARE(IF_STATIC, NAME, ARGS, ...) \
struct YOMM2_SYMBOL(NAME); \
IF_STATIC(static, ) \
yOMM2_method(NAME, ARGS, __VA_ARGS__) yOMM2_SELECTOR(NAME)( \
yOMM2_method(NAME, ARGS, __VA_ARGS__) NAME##_yomm2_guide( \
BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE(ARGS), yOMM2_PLIST, ARGS)); \
IF_STATIC(static, ) \
inline decltype(auto) NAME( \
Expand All @@ -79,7 +74,7 @@
struct _yOMM2_select; \
template<typename... A> \
struct _yOMM2_select<void(A...)> { \
using type = decltype(yOMM2_SELECTOR(NAME)(std::declval<A>()...)); \
using type = decltype(NAME##_yomm2_guide(std::declval<A>()...)); \
}; \
using method_type = _yOMM2_select<void ARGS>::type; \
using _yOMM2_return_t = method_type::return_type;
Expand Down

0 comments on commit 6b1c234

Please sign in to comment.