1 /*=============================================================================
2 Copyright (c) 2001-2010 Joel de Guzman
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 ==============================================================================*/
7 #include <boost/version.hpp>
9 // This is the same as the one in fusion in Boost 1.41. This is provided
10 // for compatibility with Boost 1.40 and below.
12 #if (BOOST_VERSION > 104000)
14 #include <boost/fusion/include/make_vector.hpp>
16 namespace boost { namespace spirit { namespace detail
20 using fusion::result_of::make_vector;
22 using fusion::make_vector;
27 #ifndef BOOST_PP_IS_ITERATING
28 #if !defined(SPIRIT_MAKE_VECTOR_07162005_0243)
29 #define SPIRIT_MAKE_VECTOR_07162005_0243
31 #include <boost/preprocessor/iterate.hpp>
32 #include <boost/preprocessor/repetition/enum_params.hpp>
33 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
34 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
35 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
36 #include <boost/fusion/container/vector/vector.hpp>
37 #include <boost/fusion/support/detail/as_fusion_element.hpp>
39 namespace boost { namespace fusion
44 namespace boost { namespace spirit { namespace detail
49 BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
50 FUSION_MAX_VECTOR_SIZE, typename T, fusion::void_)
51 , typename Extra = fusion::void_
58 typedef fusion::vector0 type;
62 inline fusion::vector0
65 return fusion::vector0();
68 #define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \
69 typename fusion::detail::as_fusion_element<BOOST_PP_CAT(T, n)>::type
71 #define BOOST_PP_FILENAME_1 <boost/spirit/home/support/detail/make_vector.hpp>
72 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
73 #include BOOST_PP_ITERATE()
75 #undef BOOST_FUSION_AS_FUSION_ELEMENT
80 #else // defined(BOOST_PP_IS_ITERATING)
81 ///////////////////////////////////////////////////////////////////////////////
83 // Preprocessor vertical repetition code
85 ///////////////////////////////////////////////////////////////////////////////
87 #define N BOOST_PP_ITERATION()
91 template <BOOST_PP_ENUM_PARAMS(N, typename T)>
92 #if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
93 #define TEXT(z, n, text) , text
94 struct make_vector< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_VECTOR_SIZE, TEXT, fusion::void_) >
97 struct make_vector<BOOST_PP_ENUM_PARAMS(N, T)>
100 typedef BOOST_PP_CAT(fusion::vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
104 template <BOOST_PP_ENUM_PARAMS(N, typename T)>
105 inline BOOST_PP_CAT(fusion::vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
106 make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
108 return BOOST_PP_CAT(fusion::vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
109 BOOST_PP_ENUM_PARAMS(N, _));
113 #endif // defined(BOOST_PP_IS_ITERATING)
114 #endif // (BOOST_VERSION > 103800)