]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/container/vector/detail/vector_n_chooser.hpp
f4b85d89c45c479640a4fc904aa42c7328e15367
[rsem.git] / boost / fusion / container / vector / detail / vector_n_chooser.hpp
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_VECTOR_N_CHOOSER_07072005_1248)
9 #define FUSION_VECTOR_N_CHOOSER_07072005_1248
10
11 #include <boost/fusion/container/vector/limits.hpp>
12
13 //  include vector0..N where N is FUSION_MAX_VECTOR_SIZE
14 #include <boost/fusion/container/vector/vector10.hpp>
15 #if (FUSION_MAX_VECTOR_SIZE > 10)
16 #include <boost/fusion/container/vector/vector20.hpp>
17 #endif
18 #if (FUSION_MAX_VECTOR_SIZE > 20)
19 #include <boost/fusion/container/vector/vector30.hpp>
20 #endif
21 #if (FUSION_MAX_VECTOR_SIZE > 30)
22 #include <boost/fusion/container/vector/vector40.hpp>
23 #endif
24 #if (FUSION_MAX_VECTOR_SIZE > 40)
25 #include <boost/fusion/container/vector/vector50.hpp>
26 #endif
27
28 #include <boost/preprocessor/cat.hpp>
29 #include <boost/preprocessor/arithmetic/dec.hpp>
30 #include <boost/preprocessor/arithmetic/sub.hpp>
31 #include <boost/preprocessor/facilities/intercept.hpp>
32 #include <boost/preprocessor/repetition/enum_params.hpp>
33 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
34
35 namespace boost { namespace fusion
36 {
37     struct void_;
38 }}
39
40 namespace boost { namespace fusion { namespace detail
41 {
42     template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
43     struct vector_n_chooser
44     {
45         typedef BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE)<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> type;
46     };
47
48     template <>
49     struct vector_n_chooser<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, void_ BOOST_PP_INTERCEPT)>
50     {
51         typedef vector0<> type;
52     };
53
54 #define BOOST_PP_FILENAME_1 \
55     <boost/fusion/container/vector/detail/vector_n_chooser.hpp>
56 #define BOOST_PP_ITERATION_LIMITS (1, BOOST_PP_DEC(FUSION_MAX_VECTOR_SIZE))
57 #include BOOST_PP_ITERATE()
58
59 }}}
60
61 #endif
62
63 ///////////////////////////////////////////////////////////////////////////////
64 //
65 //  Preprocessor vertical repetition code
66 //
67 ///////////////////////////////////////////////////////////////////////////////
68 #else // defined(BOOST_PP_IS_ITERATING)
69
70 #define N BOOST_PP_ITERATION()
71
72     template <BOOST_PP_ENUM_PARAMS(N, typename T)>
73     struct vector_n_chooser<
74         BOOST_PP_ENUM_PARAMS(N, T)
75         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(FUSION_MAX_VECTOR_SIZE, N), void_ BOOST_PP_INTERCEPT)>
76     {
77         typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> type;
78     };
79
80 #undef N
81 #endif // defined(BOOST_PP_IS_ITERATING)