PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/fusion/container/generation/make_vector.hpp

http://hadesmem.googlecode.com/
C++ Header | 91 lines | 65 code | 15 blank | 11 comment | 0 complexity | 346fcdfd4f4cc87d837499d68fb8fa67 MD5 | raw file
 1/*=============================================================================
 2    Copyright (c) 2001-2006 Joel de Guzman
 3
 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#ifndef BOOST_PP_IS_ITERATING
 8#if !defined(FUSION_MAKE_VECTOR_07162005_0243)
 9#define FUSION_MAKE_VECTOR_07162005_0243
10
11#include <boost/preprocessor/iterate.hpp>
12#include <boost/preprocessor/repetition/enum_params.hpp>
13#include <boost/preprocessor/repetition/enum_binary_params.hpp>
14#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
15#include <boost/preprocessor/repetition/repeat_from_to.hpp>
16#include <boost/fusion/container/vector/vector.hpp>
17#include <boost/fusion/support/detail/as_fusion_element.hpp>
18
19namespace boost { namespace fusion
20{
21    struct void_;
22
23    namespace result_of
24    {
25        template <
26            BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
27                FUSION_MAX_VECTOR_SIZE, typename T, void_)
28          , typename Extra = void_
29        >
30        struct make_vector;
31
32        template <>
33        struct make_vector<>
34        {
35            typedef vector0<> type;
36        };
37    }
38
39    inline vector0<>
40    make_vector()
41    {
42        return vector0<>();
43    }
44
45#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data)                               \
46    typename detail::as_fusion_element<BOOST_PP_CAT(T, n)>::type
47
48#define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/make_vector.hpp>
49#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
50#include BOOST_PP_ITERATE()
51
52#undef BOOST_FUSION_AS_FUSION_ELEMENT
53
54}}
55
56#endif
57#else // defined(BOOST_PP_IS_ITERATING)
58///////////////////////////////////////////////////////////////////////////////
59//
60//  Preprocessor vertical repetition code
61//
62///////////////////////////////////////////////////////////////////////////////
63
64#define N BOOST_PP_ITERATION()
65
66    namespace result_of
67    {
68        template <BOOST_PP_ENUM_PARAMS(N, typename T)>
69#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
70        #define TEXT(z, n, text) , text
71        struct make_vector< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_VECTOR_SIZE, TEXT, void_) >
72        #undef TEXT
73#else
74        struct make_vector<BOOST_PP_ENUM_PARAMS(N, T)>
75#endif
76        {
77            typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
78        };
79    }
80
81    template <BOOST_PP_ENUM_PARAMS(N, typename T)>
82    inline BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
83    make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
84    {
85        return BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
86            BOOST_PP_ENUM_PARAMS(N, _));
87    }
88
89#undef N
90#endif // defined(BOOST_PP_IS_ITERATING)
91