/*============================================================================= Copyright (c) 2009 Hartmut Kaiser Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_FUSION_NVIEW_SEP_23_2009_0948PM) #define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace fusion { namespace detail { struct addref { template struct result; template struct result : add_reference {}; #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template BOOST_FUSION_GPU_ENABLED typename add_reference::type operator()(T& x) const { return x; } #else template BOOST_FUSION_GPU_ENABLED typename result::type operator()(T&& x) const { return x; } #endif }; struct addconstref { template struct result; template struct result : add_reference::type> {}; template BOOST_FUSION_GPU_ENABLED typename add_reference::type>::type operator()(T& x) const { return x; } template BOOST_FUSION_GPU_ENABLED typename add_reference::type>::type operator()(T const& x) const { return x; } }; } struct nview_tag; struct random_access_traversal_tag; struct fusion_sequence_tag; template struct nview : sequence_base > { typedef nview_tag fusion_tag; typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef random_access_traversal_tag category; typedef mpl::true_ is_view; typedef Indicies index_type; typedef typename mpl::size::type size; typedef typename mpl::if_< is_const, detail::addconstref, detail::addref >::type transform_type; typedef transform_view transform_view_type; typedef typename result_of::as_vector::type sequence_type; BOOST_FUSION_GPU_ENABLED explicit nview(Sequence& val) : seq(sequence_type(transform_view_type(val, transform_type()))) {} sequence_type seq; }; }} // define the nview() generator functions #include #endif