]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2009 Hartmut Kaiser | |
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 | ||
8 | #ifndef BOOST_PP_IS_ITERATING | |
9 | ||
10 | #if !defined(BOOST_FUSION_NVIEW_IMPL_SEP_23_2009_1017PM) | |
11 | #define BOOST_FUSION_NVIEW_IMPL_SEP_23_2009_1017PM | |
12 | ||
13 | #include <climits> | |
14 | #include <boost/preprocessor/cat.hpp> | |
15 | #include <boost/preprocessor/repeat.hpp> | |
16 | #include <boost/preprocessor/iterate.hpp> | |
17 | #include <boost/preprocessor/repetition/enum_params.hpp> | |
18 | #include <boost/preprocessor/repetition/enum_binary_params.hpp> | |
19 | #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> | |
20 | #include <boost/mpl/vector_c.hpp> | |
21 | #include <boost/fusion/adapted/mpl.hpp> | |
22 | #include <boost/fusion/adapted/mpl/mpl_iterator.hpp> | |
23 | ||
24 | #define BOOST_PP_ITERATION_PARAMS_1 \ | |
25 | (3, (1, FUSION_MAX_VECTOR_SIZE, \ | |
26 | "boost/fusion/view/nview/detail/cpp03/nview_impl.hpp")) \ | |
27 | /**/ | |
28 | ||
29 | /////////////////////////////////////////////////////////////////////////////// | |
30 | namespace boost { namespace fusion { namespace result_of | |
31 | { | |
32 | template <typename Sequence | |
33 | , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_VECTOR_SIZE, int I, INT_MAX)> | |
34 | struct as_nview | |
35 | { | |
36 | typedef mpl::vector_c< | |
37 | int, BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, I) | |
38 | > index_type; | |
39 | typedef nview<Sequence, index_type> type; | |
40 | }; | |
41 | }}} | |
42 | ||
43 | #include BOOST_PP_ITERATE() | |
44 | ||
45 | #endif | |
46 | ||
47 | /////////////////////////////////////////////////////////////////////////////// | |
48 | // Preprocessor vertical repetition code | |
49 | /////////////////////////////////////////////////////////////////////////////// | |
50 | #else // defined(BOOST_PP_IS_ITERATING) | |
51 | ||
52 | #define N BOOST_PP_ITERATION() | |
53 | ||
54 | #if N < FUSION_MAX_VECTOR_SIZE | |
55 | namespace boost { namespace fusion { namespace result_of | |
56 | { | |
57 | template <typename Sequence, BOOST_PP_ENUM_PARAMS(N, int I)> | |
58 | struct as_nview<Sequence, BOOST_PP_ENUM_PARAMS(N, I)> | |
59 | { | |
60 | typedef mpl::vector_c<int, BOOST_PP_ENUM_PARAMS(N, I)> index_type; | |
61 | typedef nview<Sequence, index_type> type; | |
62 | }; | |
63 | }}} | |
64 | #endif | |
65 | ||
66 | namespace boost { namespace fusion | |
67 | { | |
68 | template<BOOST_PP_ENUM_PARAMS(N, int I), typename Sequence> | |
69 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
70 | inline nview<Sequence, mpl::vector_c<int, BOOST_PP_ENUM_PARAMS(N, I)> > | |
71 | as_nview(Sequence& s) | |
72 | { | |
73 | typedef mpl::vector_c<int, BOOST_PP_ENUM_PARAMS(N, I)> index_type; | |
74 | return nview<Sequence, index_type>(s); | |
75 | } | |
76 | ||
77 | }} | |
78 | ||
79 | #undef N | |
80 | ||
81 | #endif |