1 /*=============================================================================
2 Copyright (c) 2013-2014 Damien Buhl
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
8 #ifndef BOOST_FUSION_ADAPTER_ADT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
9 #define BOOST_FUSION_ADAPTER_ADT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
11 #include <boost/config.hpp>
13 #include <boost/fusion/adapted/struct/detail/adapt_auto.hpp>
14 #include <boost/fusion/adapted/adt/detail/adapt_base_attr_filler.hpp>
16 #include <boost/mpl/aux_/preprocessor/token_equal.hpp>
18 #include <boost/preprocessor/config/config.hpp>
19 #include <boost/preprocessor/control/iif.hpp>
20 #include <boost/preprocessor/variadic/size.hpp>
21 #include <boost/preprocessor/arithmetic/dec.hpp>
23 #if BOOST_PP_VARIADICS
25 #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(...) \
26 BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(__VA_ARGS__) \
27 BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1
29 #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(...) \
30 BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(__VA_ARGS__) \
31 BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0
33 #define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(...) \
34 ((BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__)))
36 #else // BOOST_PP_VARIADICS
38 #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(A, B, C, D, E) \
39 BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
40 BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1
42 #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(A, B, C, D, E) \
43 BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
44 BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0
46 #define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
47 BOOST_PP_IIF(BOOST_MPL_PP_TOKEN_EQUAL(auto, A), \
52 #endif // BOOST_PP_VARIADICS
54 #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0_END
55 #define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1_END
58 #define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAPPEDATTR_GET_KEY(ATTRIBUTE) \
59 BOOST_PP_TUPLE_ELEM( \
60 BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
61 BOOST_PP_DEC(BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE)), \
62 BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE))