mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 20:17:32 +02:00
BUGFIX: When VARIADICS are active supporting any of the input combination.
That is : BOOST_FUSION_ADAPT_AUTO, omitting type or specifying type.
This commit is contained in:
@ -0,0 +1,84 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013-2014 Damien Buhl
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#ifndef BOOST_FUSION_ADAPTED_ADT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP
|
||||||
|
#define BOOST_FUSION_ADAPTED_ADT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/fusion/adapted/struct/detail/preprocessor/is_seq.hpp>
|
||||||
|
|
||||||
|
#include <boost/preprocessor/control/if.hpp>
|
||||||
|
#include <boost/preprocessor/logical/or.hpp>
|
||||||
|
#include <boost/preprocessor/empty.hpp>
|
||||||
|
#include <boost/preprocessor/tuple/size.hpp>
|
||||||
|
#include <boost/preprocessor/tuple/elem.hpp>
|
||||||
|
#include <boost/preprocessor/facilities/is_empty.hpp>
|
||||||
|
#include <boost/preprocessor/variadic/to_seq.hpp>
|
||||||
|
#include <boost/preprocessor/variadic/to_tuple.hpp>
|
||||||
|
#include <boost/preprocessor/variadic/elem.hpp>
|
||||||
|
#include <boost/preprocessor/seq/for_each.hpp>
|
||||||
|
#include <boost/preprocessor/seq/push_front.hpp>
|
||||||
|
#include <boost/preprocessor/seq/rest_n.hpp>
|
||||||
|
|
||||||
|
#include <boost/preprocessor/tuple/reverse.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE) \
|
||||||
|
BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE)
|
||||||
|
|
||||||
|
#define BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE) \
|
||||||
|
BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)
|
||||||
|
|
||||||
|
#if BOOST_PP_VARIADICS
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_0(...) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_FILLER(__VA_ARGS__) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_FILLER_1
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_1(...) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_FILLER(__VA_ARGS__) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_FILLER_0
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_0_END
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_1_END
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER(...) \
|
||||||
|
BOOST_PP_IF( \
|
||||||
|
BOOST_PP_OR( \
|
||||||
|
BOOST_PP_IS_EMPTY(BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__)), \
|
||||||
|
BOOST_PP_IS_EMPTY(BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__))), \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR( \
|
||||||
|
BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__), \
|
||||||
|
BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_REST_N(3, \
|
||||||
|
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__))) ), \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(__VA_ARGS__))
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(...) \
|
||||||
|
((BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__)))
|
||||||
|
|
||||||
|
#else // BOOST_PP_VARIADICS
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_0(A, B, C, D) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(A,B,C,D) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_FILLER_1
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_1(A, B, C, D) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(A,B,C,D) \
|
||||||
|
BOOST_FUSION_ADAPT_ADT_FILLER_0
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_0_END
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_FILLER_1_END
|
||||||
|
|
||||||
|
# define BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(A, B, C, D) \
|
||||||
|
BOOST_PP_IF(BOOST_PP_IS_EMPTY(A), \
|
||||||
|
((2, (C,D))), \
|
||||||
|
((4, (A,B,C,D))) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#endif // BOOST_PP_VARIADICS
|
||||||
|
|
||||||
|
#endif
|
@ -102,9 +102,9 @@ namespace ns
|
|||||||
#if BOOST_PP_VARIADICS
|
#if BOOST_PP_VARIADICS
|
||||||
BOOST_FUSION_ADAPT_ADT(
|
BOOST_FUSION_ADAPT_ADT(
|
||||||
ns::point,
|
ns::point,
|
||||||
(int, int, obj.get_x(), obj.set_x(val))
|
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_x(), obj.set_x(val))
|
||||||
(obj.get_y(), obj.set_y(val))
|
(obj.get_y(), obj.set_y(val))
|
||||||
(obj.get_z(), obj.set_z(val))
|
(int, int, obj.get_z(), obj.set_z(val))
|
||||||
)
|
)
|
||||||
|
|
||||||
# if !BOOST_WORKAROUND(__GNUC__,<4)
|
# if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||||
|
Reference in New Issue
Block a user