forked from boostorg/fusion
Fix detection of member_type parameter emptiness for BOOST_FUSION_ADAPT_STRUCT.
As BOOST_PP_IS_EMPTY is not a general purpose emptiness checker, we limit the ways it can be used.
This commit is contained in:
@ -196,20 +196,19 @@
|
|||||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END
|
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END
|
||||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END
|
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END
|
||||||
|
|
||||||
#if BOOST_PP_VARIADICS
|
#define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTE_FILLER(X, Y) \
|
||||||
|
BOOST_PP_IF(BOOST_PP_IS_EMPTY(X), \
|
||||||
|
((1, (Y))), \
|
||||||
|
((2, (X,Y))) \
|
||||||
|
)
|
||||||
|
|
||||||
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTE_FILLER(...) \
|
#if BOOST_PP_VARIADICS
|
||||||
BOOST_PP_IF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), 2), \
|
|
||||||
BOOST_PP_IF( \
|
|
||||||
BOOST_PP_IS_EMPTY(BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__)), \
|
|
||||||
((1, (BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__)) )), \
|
|
||||||
((2, BOOST_PP_VARIADIC_TO_TUPLE(__VA_ARGS__)))), \
|
|
||||||
((1, (BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__)) )))
|
|
||||||
|
|
||||||
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER_OP(r, data, elem) \
|
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER_OP(r, data, elem) \
|
||||||
BOOST_PP_IF(BOOST_FUSION_PP_IS_SEQ(elem), \
|
BOOST_PP_IF(BOOST_FUSION_PP_IS_SEQ(elem), \
|
||||||
BOOST_PP_CAT( BOOST_FUSION_ADAPT_STRUCT_FILLER_0 elem ,_END), \
|
BOOST_PP_CAT( BOOST_FUSION_ADAPT_STRUCT_FILLER_0 elem ,_END), \
|
||||||
BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTE_FILLER(elem) \
|
BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTE_FILLER(BOOST_FUSION_ADAPT_AUTO, \
|
||||||
|
elem) \
|
||||||
)
|
)
|
||||||
|
|
||||||
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(...) \
|
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(...) \
|
||||||
@ -220,16 +219,6 @@
|
|||||||
(0,0) \
|
(0,0) \
|
||||||
)
|
)
|
||||||
|
|
||||||
#else // BOOST_PP_VARIADICS
|
|
||||||
|
|
||||||
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTE_FILLER(X, Y) \
|
|
||||||
BOOST_PP_IF(BOOST_PP_IS_EMPTY(X), \
|
|
||||||
((1, (Y))), \
|
|
||||||
((2, (X,Y))) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_PP_VARIADICS
|
#endif // BOOST_PP_VARIADICS
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ namespace ns
|
|||||||
BOOST_FUSION_ADAPT_STRUCT(
|
BOOST_FUSION_ADAPT_STRUCT(
|
||||||
ns::point,
|
ns::point,
|
||||||
(int, x)
|
(int, x)
|
||||||
(int, y),
|
(BOOST_FUSION_ADAPT_AUTO, y)
|
||||||
z
|
(, z)
|
||||||
)
|
)
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||||
|
Reference in New Issue
Block a user