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

« back to all changes in this revision

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