diff options
Diffstat (limited to 'boost/fusion/view/flatten_view/flatten_view.hpp')
-rw-r--r-- | boost/fusion/view/flatten_view/flatten_view.hpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/boost/fusion/view/flatten_view/flatten_view.hpp b/boost/fusion/view/flatten_view/flatten_view.hpp index aa47240771..8e40158d1c 100644 --- a/boost/fusion/view/flatten_view/flatten_view.hpp +++ b/boost/fusion/view/flatten_view/flatten_view.hpp @@ -8,6 +8,7 @@ #define BOOST_FUSION_FLATTEN_VIEW_HPP_INCLUDED +#include <boost/fusion/support/config.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/single_view.hpp> #include <boost/fusion/support/detail/access.hpp> @@ -23,7 +24,7 @@ namespace boost { namespace fusion { struct forward_traversal_tag; struct flatten_view_tag; - + template <typename Sequence> struct flatten_view : sequence_base<flatten_view<Sequence> > @@ -32,18 +33,21 @@ namespace boost { namespace fusion typedef fusion_sequence_tag tag; // this gets picked up by MPL typedef mpl::true_ is_view; typedef forward_traversal_tag category; - + typedef Sequence sequence_type; typedef typename result_of::begin<Sequence>::type first_type; typedef typename result_of::end<Sequence>::type last_type; - + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit flatten_view(Sequence& seq) : seq(seq) {} - + + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED first_type first() const { return fusion::begin(seq); } + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED last_type last() const { return fusion::end(seq); } - + typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq; }; }} @@ -57,19 +61,20 @@ namespace boost { namespace fusion { namespace extension struct apply { typedef typename Sequence::first_type first_type; - + typedef typename result_of::begin< mpl::single_view< typename Sequence::sequence_type> >::type root_iterator; - + typedef detail::seek_descent<root_iterator, first_type> seek_descent; - + typedef typename seek_descent::type type; + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline type call(Sequence& seq) { @@ -77,7 +82,7 @@ namespace boost { namespace fusion { namespace extension } }; }; - + template<> struct end_impl<flatten_view_tag> { @@ -85,13 +90,14 @@ namespace boost { namespace fusion { namespace extension struct apply { typedef typename Sequence::last_type last_type; - + typedef typename result_of::end< mpl::single_view< typename Sequence::sequence_type> >::type type; + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static inline type call(Sequence&) { |