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

« back to all changes in this revision

Viewing changes to boost/boost/mpl/aux_/preprocessed/no_ctps/apply.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
// preprocessed version of 'boost/mpl/apply.hpp' header
 
2
// see the original for copyright information
 
3
 
 
4
namespace boost {
 
5
namespace mpl {
 
6
 
 
7
namespace aux {
 
8
template< int arity_ > struct apply_impl_chooser;
 
9
}
 
10
 
 
11
template< typename F >
 
12
struct apply0 : F
 
13
{
 
14
    static int const arity = 1; typedef F arg1;
 
15
 friend class apply0_rebind;
 
16
 typedef apply0_rebind rebind;
 
17
 };
 
18
 class apply0_rebind { public: template< typename U1 > struct apply : apply0<U1> { };
 
19
 
 
20
};
 
21
 
 
22
namespace aux {
 
23
 
 
24
template<>
 
25
struct apply_impl_chooser<0>
 
26
{
 
27
    template<
 
28
          typename F, typename T1, typename T2, typename T3, typename T4
 
29
        , typename T5
 
30
        >
 
31
    struct result_
 
32
    {
 
33
        typedef apply0<
 
34
              F  
 
35
            > type;
 
36
    };
 
37
};
 
38
 
 
39
} // namespace aux
 
40
 
 
41
template<
 
42
      typename F, typename T1
 
43
    >
 
44
struct apply1
 
45
    : F::template apply<
 
46
          T1
 
47
        >
 
48
{
 
49
    static int const arity = 2; typedef F arg1;
 
50
 typedef T1 arg2;
 
51
 friend class apply1_rebind;
 
52
 typedef apply1_rebind rebind;
 
53
 };
 
54
 class apply1_rebind { public: template< typename U1, typename U2 > struct apply : apply1< U1,U2 > { };
 
55
 
 
56
};
 
57
 
 
58
namespace aux {
 
59
 
 
60
template<>
 
61
struct apply_impl_chooser<1>
 
62
{
 
63
    template<
 
64
          typename F, typename T1, typename T2, typename T3, typename T4
 
65
        , typename T5
 
66
        >
 
67
    struct result_
 
68
    {
 
69
        typedef apply1<
 
70
              F, T1
 
71
            > type;
 
72
    };
 
73
};
 
74
 
 
75
} // namespace aux
 
76
 
 
77
template<
 
78
      typename F, typename T1, typename T2
 
79
    >
 
80
struct apply2
 
81
    : F::template apply<
 
82
          T1, T2
 
83
        >
 
84
{
 
85
    static int const arity = 3; typedef F arg1;
 
86
 typedef T1 arg2;
 
87
 typedef T2 arg3;
 
88
 friend class apply2_rebind;
 
89
 typedef apply2_rebind rebind;
 
90
 };
 
91
 class apply2_rebind { public: template< typename U1, typename U2, typename U3 > struct apply : apply2< U1,U2,U3 > { };
 
92
 
 
93
};
 
94
 
 
95
namespace aux {
 
96
 
 
97
template<>
 
98
struct apply_impl_chooser<2>
 
99
{
 
100
    template<
 
101
          typename F, typename T1, typename T2, typename T3, typename T4
 
102
        , typename T5
 
103
        >
 
104
    struct result_
 
105
    {
 
106
        typedef apply2<
 
107
              F, T1, T2
 
108
            > type;
 
109
    };
 
110
};
 
111
 
 
112
} // namespace aux
 
113
 
 
114
template<
 
115
      typename F, typename T1, typename T2, typename T3
 
116
    >
 
117
struct apply3
 
118
    : F::template apply<
 
119
          T1, T2, T3
 
120
        >
 
121
{
 
122
    static int const arity = 4; typedef F arg1;
 
123
 typedef T1 arg2;
 
124
 typedef T2 arg3;
 
125
 typedef T3 arg4;
 
126
 friend class apply3_rebind;
 
127
 typedef apply3_rebind rebind;
 
128
 };
 
129
 class apply3_rebind { public: template< typename U1, typename U2, typename U3, typename U4 > struct apply : apply3< U1,U2,U3,U4 > { };
 
130
 
 
131
};
 
132
 
 
133
namespace aux {
 
134
 
 
135
template<>
 
136
struct apply_impl_chooser<3>
 
137
{
 
138
    template<
 
139
          typename F, typename T1, typename T2, typename T3, typename T4
 
140
        , typename T5
 
141
        >
 
142
    struct result_
 
143
    {
 
144
        typedef apply3<
 
145
              F, T1, T2, T3
 
146
            > type;
 
147
    };
 
148
};
 
149
 
 
150
} // namespace aux
 
151
 
 
152
template<
 
153
      typename F, typename T1, typename T2, typename T3, typename T4
 
154
    >
 
155
struct apply4
 
156
    : F::template apply<
 
157
          T1, T2, T3, T4
 
158
        >
 
159
{
 
160
    static int const arity = 5; typedef F arg1;
 
161
 typedef T1 arg2;
 
162
 typedef T2 arg3;
 
163
 typedef T3 arg4;
 
164
 typedef T4 arg5;
 
165
 friend class apply4_rebind;
 
166
 typedef apply4_rebind rebind;
 
167
 };
 
168
 class apply4_rebind { public: template< typename U1, typename U2, typename U3, typename U4, typename U5 > struct apply : apply4< U1,U2,U3,U4,U5 > { };
 
169
 
 
170
};
 
171
 
 
172
namespace aux {
 
173
 
 
174
template<>
 
175
struct apply_impl_chooser<4>
 
176
{
 
177
    template<
 
178
          typename F, typename T1, typename T2, typename T3, typename T4
 
179
        , typename T5
 
180
        >
 
181
    struct result_
 
182
    {
 
183
        typedef apply4<
 
184
              F, T1, T2, T3, T4
 
185
            > type;
 
186
    };
 
187
};
 
188
 
 
189
} // namespace aux
 
190
 
 
191
template<
 
192
      typename F, typename T1, typename T2, typename T3, typename T4
 
193
    , typename T5
 
194
    >
 
195
struct apply5
 
196
    : F::template apply<
 
197
          T1, T2, T3, T4, T5
 
198
        >
 
199
{
 
200
    static int const arity = 6; typedef F arg1;
 
201
 typedef T1 arg2;
 
202
 typedef T2 arg3;
 
203
 typedef T3 arg4;
 
204
 typedef T4 arg5;
 
205
 typedef T5 arg6;
 
206
 friend class apply5_rebind;
 
207
 typedef apply5_rebind rebind;
 
208
 };
 
209
 class apply5_rebind { public: template< typename U1, typename U2, typename U3, typename U4, typename U5, typename U6 > struct apply : apply5< U1,U2,U3,U4,U5,U6 > { };
 
210
 
 
211
};
 
212
 
 
213
namespace aux {
 
214
 
 
215
template<>
 
216
struct apply_impl_chooser<5>
 
217
{
 
218
    template<
 
219
          typename F, typename T1, typename T2, typename T3, typename T4
 
220
        , typename T5
 
221
        >
 
222
    struct result_
 
223
    {
 
224
        typedef apply5<
 
225
              F, T1, T2, T3, T4, T5
 
226
            > type;
 
227
    };
 
228
};
 
229
 
 
230
} // namespace aux
 
231
 
 
232
namespace aux {
 
233
 
 
234
template< typename T >
 
235
struct is_apply_arg
 
236
{
 
237
    static bool const value = true;
 
238
};
 
239
 
 
240
template<>
 
241
struct is_apply_arg<void_>
 
242
{
 
243
    static bool const value = false;
 
244
};
 
245
 
 
246
template<
 
247
      typename T1, typename T2, typename T3, typename T4, typename T5
 
248
    >
 
249
struct apply_count_args
 
250
{
 
251
    static int const value =
 
252
          is_apply_arg<T1>::value + is_apply_arg<T2>::value 
 
253
        + is_apply_arg<T3>::value + is_apply_arg<T4>::value 
 
254
        + is_apply_arg<T5>::value
 
255
        ;
 
256
};
 
257
 
 
258
} // namespace aux
 
259
 
 
260
template<
 
261
      typename F, typename T1 = void_, typename T2 = void_
 
262
    , typename T3 = void_, typename T4 = void_, typename T5 = void_
 
263
    >
 
264
struct apply
 
265
    : aux::apply_impl_chooser< 
 
266
          aux::apply_count_args< T1,T2,T3,T4,T5 >::value
 
267
        >::template result_< F,T1,T2,T3,T4,T5 >::type
 
268
{
 
269
};
 
270
 
 
271
} // namespace mpl
 
272
} // namespace boost
 
273