]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/container/vector/vector.hpp
Updated boost to v1.55.0
[rsem.git] / boost / fusion / container / vector / vector.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 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 #if !defined(FUSION_VECTOR_07072005_1244)
8 #define FUSION_VECTOR_07072005_1244
9
10 #include <boost/fusion/container/vector/vector_fwd.hpp>
11 #include <boost/fusion/container/vector/detail/vector_n_chooser.hpp>
12 #include <boost/fusion/sequence/intrinsic/begin.hpp>
13 #include <boost/mpl/at.hpp>
14 #include <boost/mpl/bool.hpp>
15 #include <boost/type_traits/add_reference.hpp>
16 #include <boost/type_traits/add_const.hpp>
17 #include <boost/type_traits/is_base_of.hpp>
18 #include <boost/detail/workaround.hpp>
19
20 #if !defined(__WAVE__)
21
22 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
23
24 #define BOOST_FUSION_VECTOR_COPY_INIT()                                       \
25     ctor_helper(rhs, is_base_of<vector, Sequence>())                          \
26
27 #define BOOST_FUSION_VECTOR_CTOR_HELPER()                                     \
28     static vector_n const&                                                    \
29     ctor_helper(vector const& rhs, mpl::true_)                                \
30     {                                                                         \
31         return rhs.vec;                                                       \
32     }                                                                         \
33                                                                               \
34     template <typename T>                                                     \
35     static T const&                                                           \
36     ctor_helper(T const& rhs, mpl::false_)                                    \
37     {                                                                         \
38         return rhs;                                                           \
39     }
40
41 #else
42
43 #define BOOST_FUSION_VECTOR_COPY_INIT()                                       \
44     rhs                                                                       \
45
46 #define BOOST_FUSION_VECTOR_CTOR_HELPER()
47
48 #endif
49
50 #endif // !defined(__WAVE__)
51
52 #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
53 #include <boost/fusion/container/vector/detail/preprocessed/vector.hpp>
54 #else
55 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
56 #pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/vvector" FUSION_MAX_VECTOR_SIZE_STR ".hpp")
57 #endif
58
59 /*=============================================================================
60     Copyright (c) 2001-2011 Joel de Guzman
61
62     Distributed under the Boost Software License, Version 1.0. (See accompanying
63     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
64
65     This is an auto-generated file. Do not edit!
66 ==============================================================================*/
67
68 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
69 #pragma wave option(preserve: 1)
70 #endif
71
72 namespace boost { namespace fusion
73 {
74     struct void_;
75     struct fusion_sequence_tag;
76
77     template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
78     struct vector
79         : sequence_base<vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> >
80     {
81     private:
82
83         typedef typename detail::vector_n_chooser<
84             BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>::type
85         vector_n;
86
87         template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
88         friend struct vector;
89
90     public:
91
92         typedef typename vector_n::types types;
93         typedef typename vector_n::fusion_tag fusion_tag;
94         typedef typename vector_n::tag tag;
95         typedef typename vector_n::size size;
96         typedef typename vector_n::category category;
97         typedef typename vector_n::is_view is_view;
98
99         vector()
100             : vec() {}
101
102         template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
103         vector(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
104             : vec(rhs.vec) {}
105
106         vector(vector const& rhs)
107             : vec(rhs.vec) {}
108
109 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
110         vector(vector&& rhs)
111             : vec(std::forward<vector_n>(rhs.vec)) {}
112 #endif
113
114         template <typename Sequence>
115         vector(Sequence const& rhs)
116             : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
117
118         //  Expand a couple of forwarding constructors for arguments
119         //  of type (T0), (T0, T1), (T0, T1, T2) etc. Example:
120         //
121         //  vector(
122         //      typename detail::call_param<T0>::type _0
123         //    , typename detail::call_param<T1>::type _1)
124         //    : vec(_0, _1) {}
125         #include <boost/fusion/container/vector/detail/vector_forward_ctor.hpp>
126
127         template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
128         vector&
129         operator=(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
130         {
131             vec = rhs.vec;
132             return *this;
133         }
134
135         template <typename T>
136         vector&
137         operator=(T const& rhs)
138         {
139             vec = rhs;
140             return *this;
141         }
142
143         vector&
144         operator=(vector const& rhs)
145         {
146             vec = rhs.vec;
147             return *this;
148         }
149
150 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
151         vector&
152         operator=(vector&& rhs)
153         {
154             vec = std::forward<vector_n>(rhs.vec);
155             return *this;
156         }
157
158         template <typename T>
159         vector&
160         operator=(T&& rhs)
161         {
162             vec = std::forward<T>(rhs);
163             return *this;
164         }
165 #endif
166
167         template <int N>
168         typename add_reference<
169             typename mpl::at_c<types, N>::type
170         >::type
171         at_impl(mpl::int_<N> index)
172         {
173             return vec.at_impl(index);
174         }
175
176         template <int N>
177         typename add_reference<
178             typename add_const<
179                 typename mpl::at_c<types, N>::type
180             >::type
181         >::type
182         at_impl(mpl::int_<N> index) const
183         {
184             return vec.at_impl(index);
185         }
186
187         template <typename I>
188         typename add_reference<
189             typename mpl::at<types, I>::type
190         >::type
191         at_impl(I /*index*/)
192         {
193             return vec.at_impl(mpl::int_<I::value>());
194         }
195
196         template<typename I>
197         typename add_reference<
198             typename add_const<
199                 typename mpl::at<types, I>::type
200             >::type
201         >::type
202         at_impl(I /*index*/) const
203         {
204             return vec.at_impl(mpl::int_<I::value>());
205         }
206
207     private:
208
209         BOOST_FUSION_VECTOR_CTOR_HELPER()
210         vector_n vec;
211     };
212 }}
213
214 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
215 #pragma wave option(output: null)
216 #endif
217
218 #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
219
220 #endif