~ubuntu-branches/ubuntu/breezy/aqsis/breezy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Will Newton
  • Date: 2004-12-07 20:06:49 UTC
  • Revision ID: james.westby@ubuntu.com-20041207200649-fccswkrvp4oc8lmn
Tags: upstream-0.9.3
ImportĀ upstreamĀ versionĀ 0.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-----------------------------------------------------------------------------
 
2
// boost mpl/aux_/erase_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_ERASE_IMPL_HPP_INCLUDED
 
18
#define BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED
 
19
 
 
20
#include "boost/mpl/clear.hpp"
 
21
#include "boost/mpl/push_front.hpp"
 
22
#include "boost/mpl/copy_backward.hpp"
 
23
#include "boost/mpl/iterator_range.hpp"
 
24
#include "boost/mpl/aux_/void_spec.hpp"
 
25
 
 
26
namespace boost {
 
27
namespace mpl {
 
28
 
 
29
// default implementation; conrete sequences might override it by 
 
30
// specializing either the |erase_traits| or the primary |erase| template
 
31
 
 
32
template< typename Tag >
 
33
struct erase_traits
 
34
{
 
35
    template<
 
36
          typename Sequence
 
37
        , typename First
 
38
        , typename Last
 
39
        >
 
40
    struct algorithm
 
41
    {
 
42
     private:
 
43
        // 1st half: [begin, first)
 
44
        typedef iterator_range<
 
45
              typename begin<Sequence>::type
 
46
            , First
 
47
            > first_half_;
 
48
 
 
49
        // 2nd half: [last, end) ... that is, [last + 1, end)
 
50
        typedef iterator_range<
 
51
              Last
 
52
            , typename end<Sequence>::type
 
53
            > second_half_;
 
54
 
 
55
        typedef typename copy_backward<
 
56
              second_half_
 
57
            , typename clear<Sequence>::type
 
58
            , push_front<_,_>
 
59
            >::type half_sequence_;
 
60
 
 
61
     public:
 
62
        typedef typename copy_backward<
 
63
              first_half_
 
64
            , half_sequence_
 
65
            , push_front<_,_>
 
66
            >::type type;
 
67
    };
 
68
 
 
69
};
 
70
 
 
71
} // namespace mpl
 
72
} // namespace boost
 
73
 
 
74
#endif // BOOST_MPL_AUX_ERASE_IMPL_HPP_INCLUDED