File indexing completed on 2025-01-18 09:34:39
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(FUSION_VECTOR_07072005_1244)
0009 #define FUSION_VECTOR_07072005_1244
0010
0011 #include <boost/preprocessor/iterate.hpp>
0012 #include <boost/preprocessor/repetition/enum_params.hpp>
0013 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0014 #include <boost/fusion/support/config.hpp>
0015 #include <boost/fusion/support/void.hpp>
0016 #include <boost/fusion/support/detail/enabler.hpp>
0017 #include <boost/fusion/support/is_sequence.hpp>
0018 #include <boost/fusion/container/vector/vector_fwd.hpp>
0019 #include <boost/fusion/container/vector/detail/cpp03/vector_n_chooser.hpp>
0020 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0021 #include <boost/mpl/at.hpp>
0022 #include <boost/mpl/bool.hpp>
0023 #include <boost/type_traits/add_reference.hpp>
0024 #include <boost/type_traits/add_const.hpp>
0025 #include <boost/type_traits/is_base_of.hpp>
0026 #include <boost/type_traits/remove_cv_ref.hpp>
0027 #include <boost/detail/workaround.hpp>
0028 #include <boost/core/enable_if.hpp>
0029
0030 #define FUSION_HASH #
0031
0032 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
0033
0034 #define BOOST_FUSION_VECTOR_COPY_INIT() \
0035 ctor_helper(rhs, is_base_of<vector, Sequence>()) \
0036
0037 #define BOOST_FUSION_VECTOR_CTOR_HELPER() \
0038 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
0039 static vector_n const& \
0040 ctor_helper(vector const& rhs, mpl::true_) \
0041 { \
0042 return rhs.vec; \
0043 } \
0044 \
0045 template <typename T> \
0046 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
0047 static T const& \
0048 ctor_helper(T const& rhs, mpl::false_) \
0049 { \
0050 return rhs; \
0051 }
0052
0053 #else
0054
0055 #define BOOST_FUSION_VECTOR_COPY_INIT() \
0056 rhs \
0057
0058 #define BOOST_FUSION_VECTOR_CTOR_HELPER()
0059
0060 #endif
0061
0062 #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
0063 #include <boost/fusion/container/vector/detail/cpp03/preprocessed/vector.hpp>
0064 #else
0065 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0066 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/vvector" FUSION_MAX_VECTOR_SIZE_STR ".hpp")
0067 #endif
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0079 #pragma wave option(preserve: 1)
0080 #endif
0081
0082 namespace boost { namespace fusion
0083 {
0084 struct void_;
0085 struct fusion_sequence_tag;
0086
0087 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
0088 struct vector
0089 : sequence_base<vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> >
0090 {
0091 private:
0092
0093 typedef typename detail::vector_n_chooser<
0094 BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>::type
0095 vector_n;
0096
0097 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
0098 friend struct vector;
0099
0100 public:
0101
0102 typedef typename vector_n::types types;
0103 typedef typename vector_n::fusion_tag fusion_tag;
0104 typedef typename vector_n::tag tag;
0105 typedef typename vector_n::size size;
0106 typedef typename vector_n::category category;
0107 typedef typename vector_n::is_view is_view;
0108
0109 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0110 vector()
0111 : vec() {}
0112
0113 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
0114 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0115 vector(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
0116 : vec(rhs.vec) {}
0117
0118 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0119 vector(vector const& rhs)
0120 : vec(rhs.vec) {}
0121
0122 template <typename Sequence>
0123 BOOST_FUSION_GPU_ENABLED
0124 vector(Sequence const& rhs,
0125 typename enable_if<traits::is_sequence<Sequence>, detail::enabler_>::type = detail::enabler)
0126 : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
0127
0128
0129
0130
0131
0132
0133
0134
0135 #include <boost/fusion/container/vector/detail/cpp03/vector_forward_ctor.hpp>
0136
0137 template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
0138 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0139 vector&
0140 operator=(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
0141 {
0142 vec = rhs.vec;
0143 return *this;
0144 }
0145
0146 template <typename T>
0147 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0148 vector&
0149 operator=(T const& rhs)
0150 {
0151 vec = rhs;
0152 return *this;
0153 }
0154
0155 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0156 vector&
0157 operator=(vector const& rhs)
0158 {
0159 vec = rhs.vec;
0160 return *this;
0161 }
0162
0163 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0164 FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0165 #endif
0166 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
0167 (defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
0168 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0169 vector(vector&& rhs)
0170 : vec(std::forward<vector_n>(rhs.vec)) {}
0171
0172 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0173 vector&
0174 operator=(vector&& rhs)
0175 {
0176 vec = std::forward<vector_n>(rhs.vec);
0177 return *this;
0178 }
0179
0180 template <typename T>
0181 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0182 typename boost::disable_if_c<
0183 boost::is_same<vector, typename boost::remove_cv_ref<T>::type>::value
0184 , vector&
0185 >::type
0186 operator=(T&& rhs)
0187 {
0188 vec = BOOST_FUSION_FWD_ELEM(T, rhs);
0189 return *this;
0190 }
0191 #endif
0192 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0193 FUSION_HASH endif
0194 #endif
0195
0196 template <int N>
0197 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0198 typename add_reference<
0199 typename mpl::at_c<types, N>::type
0200 >::type
0201 at_impl(mpl::int_<N> index)
0202 {
0203 return vec.at_impl(index);
0204 }
0205
0206 template <int N>
0207 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0208 typename add_reference<
0209 typename add_const<
0210 typename mpl::at_c<types, N>::type
0211 >::type
0212 >::type
0213 at_impl(mpl::int_<N> index) const
0214 {
0215 return vec.at_impl(index);
0216 }
0217
0218 template <typename I>
0219 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0220 typename add_reference<
0221 typename mpl::at<types, I>::type
0222 >::type
0223 at_impl(I )
0224 {
0225 return vec.at_impl(mpl::int_<I::value>());
0226 }
0227
0228 template<typename I>
0229 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0230 typename add_reference<
0231 typename add_const<
0232 typename mpl::at<types, I>::type
0233 >::type
0234 >::type
0235 at_impl(I ) const
0236 {
0237 return vec.at_impl(mpl::int_<I::value>());
0238 }
0239
0240 private:
0241
0242 BOOST_FUSION_VECTOR_CTOR_HELPER()
0243 vector_n vec;
0244 };
0245 }}
0246
0247 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
0248 #pragma wave option(output: null)
0249 #endif
0250
0251 #endif
0252
0253 #undef FUSION_HASH
0254 #endif