Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:31:17

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
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(FUSION_INSERT_RANGE_009172005_1147)
0008 #define FUSION_INSERT_RANGE_009172005_1147
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
0012 #include <boost/fusion/view/joint_view/joint_view.hpp>
0013 #include <boost/fusion/view/iterator_range/iterator_range.hpp>
0014 #include <boost/fusion/support/detail/as_fusion_element.hpp>
0015 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0016 #include <boost/fusion/sequence/intrinsic/end.hpp>
0017 #include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
0018 
0019 namespace boost { namespace fusion
0020 {
0021     namespace result_of
0022     {
0023         template <typename Sequence, typename Position, typename Range>
0024         struct insert_range
0025         {
0026             typedef typename convert_iterator<Position>::type pos_type;
0027             typedef typename result_of::begin<Sequence>::type first_type;
0028             typedef typename result_of::end<Sequence>::type last_type;
0029 
0030             typedef iterator_range<first_type, pos_type> left_type;
0031             typedef iterator_range<pos_type, last_type> right_type;
0032             typedef joint_view<left_type, Range> left_insert_type;
0033             typedef joint_view<left_insert_type, right_type> type;
0034         };
0035     }
0036 
0037     template <typename Sequence, typename Position, typename Range>
0038     BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0039     inline typename result_of::insert_range<Sequence const, Position, Range const>::type
0040     insert_range(Sequence const& seq, Position const& pos, Range const& range)
0041     {
0042         typedef result_of::insert_range<Sequence const, Position, Range const> result_of;
0043         typedef typename result_of::left_type left_type;
0044         typedef typename result_of::right_type right_type;
0045         typedef typename result_of::left_insert_type left_insert_type;
0046         typedef typename result_of::type result;
0047 
0048         left_type left(fusion::begin(seq), convert_iterator<Position>::call(pos));
0049         right_type right(convert_iterator<Position>::call(pos), fusion::end(seq));
0050         left_insert_type left_insert(left, range);
0051         return result(left_insert, right);
0052     }
0053 }}
0054 
0055 #endif
0056