Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 #ifndef BOOST_MPL_INSERT_IMPL_HPP_INCLUDED
0003 #define BOOST_MPL_INSERT_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/reverse_fold.hpp>
0018 #include <boost/mpl/iterator_range.hpp>
0019 #include <boost/mpl/clear.hpp>
0020 #include <boost/mpl/push_front.hpp>
0021 #include <boost/mpl/aux_/na_spec.hpp>
0022 #include <boost/mpl/aux_/traits_lambda_spec.hpp>
0023 #include <boost/type_traits/is_same.hpp>
0024 
0025 namespace boost { namespace mpl {
0026 
0027 // default implementation; conrete sequences might override it by 
0028 // specializing either the 'insert_impl' or the primary 'insert' template
0029 
0030 template< typename Tag >
0031 struct insert_impl
0032 {
0033     template<
0034           typename Sequence
0035         , typename Pos
0036         , typename T
0037         >
0038     struct apply
0039     {
0040         typedef iterator_range<
0041               typename begin<Sequence>::type
0042             , Pos
0043             > first_half_;
0044 
0045         typedef iterator_range<
0046               Pos
0047             , typename end<Sequence>::type
0048             > second_half_;
0049 
0050         typedef typename reverse_fold<
0051               second_half_
0052             , typename clear<Sequence>::type
0053             , push_front<_,_>
0054             >::type half_sequence_;
0055 
0056         typedef typename reverse_fold<
0057               first_half_
0058             , typename push_front<half_sequence_,T>::type
0059             , push_front<_,_>
0060             >::type type;
0061     };
0062 };
0063 
0064 BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_impl)
0065 
0066 }}
0067 
0068 #endif // BOOST_MPL_INSERT_IMPL_HPP_INCLUDED