1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
3 Copyright (c) 2009-2011 Christopher Schmidt
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
9 #ifndef BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
10 #define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
12 #include <boost/preprocessor/cat.hpp>
13 #include <boost/preprocessor/empty.hpp>
14 #include <boost/type_traits/add_reference.hpp>
15 #include <boost/type_traits/is_const.hpp>
16 #include <boost/type_traits/add_const.hpp>
17 #include <boost/type_traits/remove_const.hpp>
19 #include <boost/fusion/adapted/struct/detail/extension.hpp>
20 #include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
21 #include <boost/fusion/adapted/struct/detail/at_impl.hpp>
22 #include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
23 #include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
24 #include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
25 #include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
26 #include <boost/fusion/adapted/struct/detail/size_impl.hpp>
27 #include <boost/fusion/adapted/struct/detail/begin_impl.hpp>
28 #include <boost/fusion/adapted/struct/detail/end_impl.hpp>
29 #include <boost/fusion/adapted/struct/detail/value_of_impl.hpp>
30 #include <boost/fusion/adapted/struct/detail/deref_impl.hpp>
32 #define BOOST_FUSION_ADAPT_STRUCT_FILLER_0(X, Y) \
33 ((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_1
34 #define BOOST_FUSION_ADAPT_STRUCT_FILLER_1(X, Y) \
35 ((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_0
36 #define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END
37 #define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END
39 #define BOOST_FUSION_ADAPT_STRUCT_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE)\
40 BOOST_FUSION_ADAPT_STRUCT_C_BASE( \
41 TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,BOOST_PP_EMPTY,ATTRIBUTE,2)
43 #define BOOST_FUSION_ADAPT_TPL_STRUCT(TEMPLATE_PARAMS_SEQ,NAME_SEQ, ATTRIBUTES) \
44 BOOST_FUSION_ADAPT_STRUCT_BASE( \
45 (1)TEMPLATE_PARAMS_SEQ, \
49 ((0,0)) BOOST_PP_CAT( \
50 BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
51 BOOST_FUSION_ADAPT_STRUCT_C)
53 #define BOOST_FUSION_ADAPT_STRUCT(NAME, ATTRIBUTES) \
54 BOOST_FUSION_ADAPT_STRUCT_BASE( \
59 BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
60 BOOST_FUSION_ADAPT_STRUCT_C)
62 #define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \
63 BOOST_FUSION_ADAPT_STRUCT_BASE( \
68 BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
69 BOOST_FUSION_ADAPT_STRUCT_C)