File indexing completed on 2025-12-16 09:49:45
0001
0002
0003
0004
0005
0006
0007
0008 #if !defined(BOOST_FUSION_NVIEW_SEP_23_2009_0948PM)
0009 #define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM
0010
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/mpl/if.hpp>
0013
0014 #include <boost/type_traits/add_reference.hpp>
0015 #include <boost/type_traits/add_const.hpp>
0016
0017 #include <boost/fusion/support/is_view.hpp>
0018 #include <boost/fusion/support/sequence_base.hpp>
0019 #include <boost/fusion/container/vector.hpp>
0020 #include <boost/fusion/sequence/intrinsic/size.hpp>
0021 #include <boost/fusion/view/transform_view.hpp>
0022
0023 #include <boost/config.hpp>
0024
0025 namespace boost { namespace fusion
0026 {
0027 namespace detail
0028 {
0029 struct addref
0030 {
0031 template<typename Sig>
0032 struct result;
0033
0034 template<typename U>
0035 struct result<addref(U)> : add_reference<U> {};
0036
0037 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
0038 template <typename T>
0039 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0040 typename add_reference<T>::type
0041 operator()(T& x) const
0042 {
0043 return x;
0044 }
0045 #else
0046 template <typename T>
0047 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0048 typename result<addref(T)>::type
0049 operator()(T&& x) const
0050 {
0051 return x;
0052 }
0053 #endif
0054 };
0055
0056 struct addconstref
0057 {
0058 template<typename Sig>
0059 struct result;
0060
0061 template<typename U>
0062 struct result<addconstref(U)>
0063 : add_reference<typename add_const<U>::type>
0064 {};
0065
0066 template <typename T>
0067 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0068 typename add_reference<typename add_const<T>::type>::type
0069 operator()(T& x) const
0070 {
0071 return x;
0072 }
0073
0074 template <typename T>
0075 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0076 typename add_reference<typename add_const<T>::type>::type
0077 operator()(T const& x) const
0078 {
0079 return x;
0080 }
0081 };
0082 }
0083
0084 struct nview_tag;
0085 struct random_access_traversal_tag;
0086 struct fusion_sequence_tag;
0087
0088 template<typename Sequence, typename Indicies>
0089 struct nview
0090 : sequence_base<nview<Sequence, Indicies> >
0091 {
0092 typedef nview_tag fusion_tag;
0093 typedef fusion_sequence_tag tag;
0094 typedef random_access_traversal_tag category;
0095
0096 typedef mpl::true_ is_view;
0097 typedef Indicies index_type;
0098 typedef typename result_of::size<Indicies>::type size;
0099
0100 typedef typename mpl::if_<
0101 is_const<Sequence>, detail::addconstref, detail::addref
0102 >::type transform_type;
0103 typedef transform_view<Sequence, transform_type> transform_view_type;
0104 typedef typename result_of::as_vector<transform_view_type>::type
0105 sequence_type;
0106
0107 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0108 explicit nview(Sequence& val)
0109 : seq(sequence_type(transform_view_type(val, transform_type())))
0110 {}
0111
0112 sequence_type seq;
0113 };
0114
0115 }}
0116
0117
0118 #include <boost/fusion/view/nview/detail/nview_impl.hpp>
0119
0120 #endif
0121
0122