~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/mpl/aux_/insert_range_impl.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-----------------------------------------------------------------------------
 
2
// boost mpl/insert_range_impl.hpp header file
 
3
// See http://www.boost.org for updates, documentation, and revision history.
 
4
//-----------------------------------------------------------------------------
 
5
//
 
6
// Copyright (c) 2000-02
 
7
// Aleksey Gurtovoy
 
8
//
 
9
// Permission to use, copy, modify, distribute and sell this software
 
10
// and its documentation for any purpose is hereby granted without fee, 
 
11
// provided that the above copyright notice appears in all copies and 
 
12
// that both the copyright notice and this permission notice appear in 
 
13
// supporting documentation. No representations are made about the 
 
14
// suitability of this software for any purpose. It is provided "as is" 
 
15
// without express or implied warranty.
 
16
 
 
17
#ifndef BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
 
18
#define BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
 
19
 
 
20
#include "boost/mpl/iter_fold_backward.hpp"
 
21
#include "boost/mpl/fold_backward.hpp"
 
22
#include "boost/mpl/clear.hpp"
 
23
#include "boost/mpl/push_front.hpp"
 
24
#include "boost/mpl/identity.hpp"
 
25
#include "boost/mpl/apply_if.hpp"
 
26
#include "boost/mpl/aux_/void_spec.hpp"
 
27
#include "boost/mpl/aux_/iter_push_front.hpp"
 
28
#include "boost/mpl/aux_/traits_lambda_spec.hpp"
 
29
#include "boost/type_traits/same_traits.hpp"
 
30
 
 
31
namespace boost {
 
32
namespace mpl {
 
33
 
 
34
// default implementation; conrete sequences might override it by 
 
35
// specializing either the |insert_range_traits| or the primary 
 
36
// |insert_range| template
 
37
 
 
38
namespace aux {
 
39
 
 
40
template<
 
41
      typename Pos
 
42
    , typename Range
 
43
    >
 
44
struct iter_range_inserter
 
45
{
 
46
    template< typename Sequence, typename Iterator > struct apply
 
47
    {
 
48
        typedef typename aux::iter_push_front<
 
49
              typename apply_if<
 
50
                  is_same<Pos,typename Iterator::next>
 
51
                , fold_backward< Range, Sequence, push_front<_,_> >
 
52
                , identity<Sequence>
 
53
                >::type
 
54
            , Iterator
 
55
            >::type type;
 
56
    };
 
57
};
 
58
 
 
59
} // namespace aux
 
60
 
 
61
 
 
62
template< typename Tag >
 
63
struct insert_range_traits
 
64
{
 
65
    template<
 
66
          typename Sequence
 
67
        , typename Pos
 
68
        , typename Range
 
69
        >
 
70
    struct algorithm
 
71
    {
 
72
        typedef typename iter_fold_backward<
 
73
              Sequence
 
74
            , typename clear<Sequence>::type
 
75
            , aux::iter_range_inserter<Pos,Range>
 
76
            >::type type;
 
77
    };
 
78
};
 
79
 
 
80
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_range_traits)
 
81
 
 
82
} // namespace mpl
 
83
} // namespace boost
 
84
 
 
85
#endif // BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED