1 /*============================================================================= 2 Copyright (c) 2011 Eric Niebler 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(BOOST_FUSION_SEGMENTED_SEQUENCE_HPP_INCLUDED) 8 #define BOOST_FUSION_SEGMENTED_SEQUENCE_HPP_INCLUDED 9 10 #include <boost/fusion/support/config.hpp> 11 #include <boost/mpl/bool.hpp> 12 #include <boost/type_traits/remove_reference.hpp> 13 #include <boost/fusion/support/tag_of.hpp> 14 #include <boost/fusion/sequence/intrinsic_fwd.hpp> 15 16 namespace boost { namespace fusion { namespace detail 17 { 18 struct segment_sequence_tag {}; 19 20 // Here, Sequence is a sequence of ranges (which may or may not be 21 // segmented). 22 template<typename Sequence> 23 struct segment_sequence 24 : sequence_base<segment_sequence<Sequence> > 25 { 26 typedef fusion_sequence_tag tag; 27 typedef segment_sequence_tag fusion_tag; 28 typedef typename Sequence::is_view is_view; 29 typedef typename Sequence::category category; 30 typedef Sequence sequence_type; 31 sequence_type sequence; 32 segment_sequenceboost::fusion::detail::segment_sequence33 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit segment_sequence(Sequence const & seq) 34 : sequence(seq) 35 {} 36 }; 37 } 38 39 namespace extension 40 { 41 template<typename Tag> 42 struct is_segmented_impl; 43 44 template<> 45 struct is_segmented_impl<detail::segment_sequence_tag> 46 { 47 template<typename Sequence> 48 struct apply 49 : mpl::true_ 50 {}; 51 }; 52 53 template<typename Tag> 54 struct segments_impl; 55 56 template<> 57 struct segments_impl<detail::segment_sequence_tag> 58 { 59 template<typename Sequence> 60 struct apply 61 { 62 typedef typename Sequence::sequence_type type; 63 64 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED callboost::fusion::extension::segments_impl::apply65 static type call(Sequence & seq) 66 { 67 return seq.sequence; 68 } 69 }; 70 }; 71 }}} 72 73 #endif 74