Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:41:55

0001 /*=============================================================================
0002     Copyright (c) 2007 Tobias Schwinger
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 
0008 #if !defined(BOOST_FUSION_REPETITIVE_VIEW_NEXT_IMPL_HPP_INCLUDED)
0009 #define BOOST_FUSION_REPETITIVE_VIEW_NEXT_IMPL_HPP_INCLUDED
0010 
0011 #include <boost/fusion/support/config.hpp>
0012 #include <boost/fusion/iterator/next.hpp>
0013 #include <boost/fusion/iterator/equal_to.hpp>
0014 
0015 namespace boost { namespace fusion
0016 {
0017     struct repetitive_view_iterator_tag;
0018 
0019     template <typename Sequence, typename Pos>
0020     struct repetitive_view_iterator;
0021 
0022     namespace extension
0023     {
0024         template <typename Tag>
0025         struct next_impl;
0026 
0027         template <>
0028         struct next_impl<repetitive_view_iterator_tag>
0029         {
0030             template<typename Iterator, 
0031                 bool Last = result_of::equal_to<typename Iterator::end_type,
0032                     typename result_of::next<
0033                         typename Iterator::pos_type
0034                     >::type>::value > 
0035             struct apply_nonempty // <Iterator,false>
0036             {
0037                 // advanvce to next position
0038 
0039                 typedef repetitive_view_iterator<
0040                     typename Iterator::sequence_type,
0041                     typename result_of::next<typename Iterator::pos_type>::type
0042                     >
0043                 type;
0044 
0045                 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0046                 static type call(Iterator const& i)
0047                 {
0048                     return type(i.seq, next(i.pos));
0049                 }
0050             };
0051             template <typename Iterator>
0052             struct apply_nonempty<Iterator,true>
0053             {
0054                 // reset to beginning
0055 
0056                 typedef repetitive_view_iterator<
0057                     typename Iterator::sequence_type,
0058                     typename Iterator::first_type
0059                     > 
0060                 type;
0061 
0062                 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0063                 static type call(Iterator const& i)
0064                 {
0065                     return type(i.seq);
0066                 }    
0067             };
0068 
0069             template <typename Iterator,
0070                 bool Empty = result_of::equal_to<typename Iterator::end_type,
0071                     typename Iterator::pos_type>::value >
0072             struct apply // <Iterator,false>
0073                 : apply_nonempty<Iterator>
0074             { };
0075 
0076             template <typename Iterator>
0077             struct apply<Iterator,true>
0078             {
0079                 // eps^n = eps
0080 
0081                 typedef Iterator type;
0082 
0083                 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0084                 static type call(Iterator const& i)
0085                 {
0086                     return type(i);
0087                 }
0088             };
0089         };
0090     }
0091 }}
0092 
0093 #endif
0094