Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:42

0001 /*=============================================================================
0002     Copyright (c) 2006 Eric Niebler
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(BOOST_FUSION_SEGMENTS_04052005_1141)
0008 #define BOOST_FUSION_SEGMENTS_04052005_1141
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/type_traits/is_const.hpp>
0012 #include <boost/utility/enable_if.hpp>
0013 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
0014 #include <boost/fusion/support/tag_of.hpp>
0015 
0016 namespace boost { namespace fusion
0017 {
0018     // Special tags:
0019     struct sequence_facade_tag;
0020     struct iterator_range_tag;
0021 
0022     // segments: returns a sequence of sequences
0023     namespace extension
0024     {
0025         template <typename Tag>
0026         struct segments_impl
0027         {
0028             template <typename Sequence>
0029             struct apply {};
0030         };
0031 
0032         template <>
0033         struct segments_impl<sequence_facade_tag>
0034         {
0035             template <typename Sequence>
0036             struct apply : Sequence::template segments<Sequence> {};
0037         }; 
0038 
0039         template <>
0040         struct segments_impl<iterator_range_tag>;
0041     }
0042 
0043     namespace result_of
0044     {
0045         template <typename Sequence>
0046         struct segments
0047         {
0048             typedef typename traits::tag_of<Sequence>::type tag_type;
0049 
0050             typedef typename
0051                 extension::segments_impl<tag_type>::template apply<Sequence>::type
0052             type;
0053         };
0054     }
0055 
0056     template <typename Sequence>
0057     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0058     inline typename
0059         lazy_disable_if<
0060             is_const<Sequence>
0061           , result_of::segments<Sequence>
0062         >::type
0063     segments(Sequence& seq)
0064     {
0065         typedef typename traits::tag_of<Sequence>::type tag_type;
0066         return extension::segments_impl<tag_type>::template apply<Sequence>::call(seq);
0067     }
0068 
0069     template <typename Sequence>
0070     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0071     inline typename result_of::segments<Sequence const>::type
0072     segments(Sequence const& seq)
0073     {
0074         typedef typename traits::tag_of<Sequence const>::type tag_type;
0075         return extension::segments_impl<tag_type>::template apply<Sequence const>::call(seq);
0076     }
0077 }}
0078 
0079 #endif