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

« back to all changes in this revision

Viewing changes to boost/boost/mpl/aux_/joint_iter.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/aux_/joint_iter.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_JOINT_ITER_HPP_INCLUDED
 
18
#define BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
 
19
 
 
20
#include "boost/mpl/aux_/lambda_spec.hpp"
 
21
#include "boost/mpl/aux_/config/ctps.hpp"
 
22
#include "boost/type_traits/is_same.hpp"
 
23
 
 
24
namespace boost { namespace mpl {
 
25
 
 
26
namespace aux {
 
27
 
 
28
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 
29
 
 
30
template<
 
31
      typename Iterator1
 
32
    , typename LastIterator1
 
33
    , typename Iterator2
 
34
    >
 
35
struct joint_iter
 
36
{
 
37
    typedef Iterator1 base;
 
38
    typedef typename base::category category;
 
39
    typedef joint_iter<
 
40
          typename base::next
 
41
        , LastIterator1
 
42
        , Iterator2
 
43
        > next;
 
44
 
 
45
    typedef typename base::type type;
 
46
};
 
47
 
 
48
template<
 
49
      typename LastIterator1
 
50
    , typename Iterator2
 
51
    >
 
52
struct joint_iter<LastIterator1,LastIterator1,Iterator2>
 
53
{
 
54
    typedef Iterator2 base;
 
55
    typedef typename base::category category;
 
56
    typedef joint_iter<
 
57
          LastIterator1
 
58
        , LastIterator1
 
59
        , typename base::next
 
60
        > next;
 
61
 
 
62
    typedef typename base::type type;
 
63
};
 
64
 
 
65
 
 
66
#else
 
67
 
 
68
// forward decl. for 'joint_iter_impl'
 
69
template<
 
70
      typename Iterator1
 
71
    , typename LastIterator1
 
72
    , typename Iterator2
 
73
    >
 
74
struct joint_iter;
 
75
 
 
76
template< bool > struct joint_iter_impl
 
77
{
 
78
    template< 
 
79
          typename Iterator1
 
80
        , typename LastIterator1
 
81
        , typename Iterator2
 
82
        >
 
83
    struct result_
 
84
    {
 
85
        typedef Iterator1 base;
 
86
        // agurt, 16/nov/02: have to use 'Iterator1' instead of 'base' below
 
87
        // to prevent 'base' and 'mpl::base' conflict on MSVC 6.0
 
88
        typedef typename Iterator1::category category;
 
89
        typedef joint_iter<
 
90
              typename Iterator1::next
 
91
            , LastIterator1
 
92
            , Iterator2
 
93
            > next;
 
94
 
 
95
        typedef typename Iterator1::type type;
 
96
    };
 
97
};
 
98
 
 
99
template<> struct joint_iter_impl<true>
 
100
{
 
101
    template< 
 
102
          typename Iterator1
 
103
        , typename LastIterator1
 
104
        , typename Iterator2
 
105
        >
 
106
    struct result_
 
107
    {
 
108
        typedef Iterator2 base;
 
109
        typedef typename Iterator2::category category;
 
110
        typedef joint_iter<
 
111
              LastIterator1
 
112
            , LastIterator1
 
113
            , typename Iterator2::next
 
114
            > next;
 
115
 
 
116
        typedef typename Iterator2::type type;
 
117
    };
 
118
};
 
119
 
 
120
 
 
121
template<
 
122
      typename Iterator1
 
123
    , typename LastIterator1
 
124
    , typename Iterator2
 
125
    >
 
126
struct joint_iter
 
127
    : joint_iter_impl< is_same<Iterator1,LastIterator1>::value >
 
128
        ::template result_<Iterator1,LastIterator1,Iterator2>
 
129
{
 
130
};
 
131
 
 
132
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 
133
 
 
134
} // namespace aux
 
135
 
 
136
BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::joint_iter)
 
137
 
 
138
}} // namespace boost::mpl
 
139
 
 
140
#endif // BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED