1
2#ifndef BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
3#define BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
4
5// Copyright Aleksey Gurtovoy 2000-2004
6//
7// Distributed under the Boost Software License, Version 1.0.
8// (See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// See http://www.boost.org/libs/mpl for documentation.
12
13// $Id$
14// $Date$
15// $Revision$
16
17#include <boost/mpl/placeholders.hpp>
18#include <boost/mpl/fold.hpp>
19#include <boost/mpl/insert.hpp>
20#include <boost/mpl/clear.hpp>
21#include <boost/mpl/joint_view.hpp>
22#include <boost/mpl/iterator_range.hpp>
23#include <boost/mpl/aux_/na_spec.hpp>
24#include <boost/mpl/aux_/iter_push_front.hpp>
25#include <boost/mpl/aux_/traits_lambda_spec.hpp>
26#include <boost/mpl/aux_/config/forwarding.hpp>
27
28#include <boost/type_traits/same_traits.hpp>
29
30namespace boost { namespace mpl {
31
32// default implementation; conrete sequences might override it by
33// specializing either the 'insert_range_impl' or the primary
34// 'insert_range' template
35
36
37template< typename Tag >
38struct insert_range_impl
39{
40 template<
41 typename Sequence
42 , typename Pos
43 , typename Range
44 >
45 struct apply
46#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
47 : reverse_fold<
48 joint_view<
49 iterator_range<typename begin<Sequence>::type,Pos>
50 , joint_view<
51 Range
52 , iterator_range<Pos,typename end<Sequence>::type>
53 >
54 >
55 , typename clear<Sequence>::type
56 , insert<_1, begin<_1>, _2>
57 >
58 {
59#else
60 {
61 typedef typename reverse_fold<
62 joint_view<
63 iterator_range<typename begin<Sequence>::type,Pos>
64 , joint_view<
65 Range
66 , iterator_range<Pos,typename end<Sequence>::type>
67 >
68 >
69 , typename clear<Sequence>::type
70 , insert<_1, begin<_1>, _2>
71 >::type type;
72#endif
73 };
74};
75
76BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_range_impl)
77
78}}
79
80#endif // BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
81

source code of boost/boost/mpl/aux_/insert_range_impl.hpp