Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:37

0001 
0002 #ifndef BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED
0003 #define BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/clear.hpp>
0018 #include <boost/mpl/push_front.hpp>
0019 #include <boost/mpl/reverse_fold.hpp>
0020 #include <boost/mpl/iterator_range.hpp>
0021 #include <boost/mpl/next.hpp>
0022 #include <boost/mpl/aux_/na.hpp>
0023 
0024 namespace boost { namespace mpl {
0025 
0026 // default implementation; conrete sequences might override it by 
0027 // specializing either the 'erase_impl' or the primary 'erase' template
0028 
0029 template< typename Tag >
0030 struct erase_impl
0031 {
0032     template<
0033           typename Sequence
0034         , typename First
0035         , typename Last
0036         >
0037     struct apply
0038     {
0039         typedef typename if_na< Last,typename next<First>::type >::type last_;
0040         
0041         // 1st half: [begin, first)
0042         typedef iterator_range<
0043               typename begin<Sequence>::type
0044             , First
0045             > first_half_;
0046 
0047         // 2nd half: [last, end) ... that is, [last + 1, end)
0048         typedef iterator_range<
0049               last_
0050             , typename end<Sequence>::type
0051             > second_half_;
0052 
0053         typedef typename reverse_fold<
0054               second_half_
0055             , typename clear<Sequence>::type
0056             , push_front<_,_>
0057             >::type half_sequence_;
0058 
0059         typedef typename reverse_fold<
0060               first_half_
0061             , half_sequence_
0062             , push_front<_,_>
0063             >::type type;
0064     };
0065 };
0066 
0067 }}
0068 
0069 #endif // BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED