source: NonGTP/Boost/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp @ 857

Revision 857, 2.8 KB checked in by igarcia, 19 years ago (diff)
Line 
1
2// Copyright Aleksey Gurtovoy 2001-2004
3//
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//
8
9// Preprocessed version of "boost/mpl/aux_/template_arity.hpp" header
10// -- DO NOT modify by hand!
11
12namespace boost { namespace mpl { namespace aux {
13
14template< int N > struct arity_tag
15{
16    typedef char (&type)[N + 1];
17};
18
19template<
20      int C1, int C2, int C3, int C4, int C5, int C6
21    >
22struct max_arity
23{
24    BOOST_STATIC_CONSTANT(int, value =
25          ( C6 > 0 ? C6 : ( C5 > 0 ? C5 : ( C4 > 0 ? C4 : ( C3 > 0 ? C3 : ( C2 > 0 ? C2 : ( C1 > 0 ? C1 : -1 ) ) ) ) ) )
26
27        );
28};
29
30arity_tag<0>::type arity_helper(...);
31
32template<
33      template< typename P1 > class F
34    , typename T1
35    >
36typename arity_tag<1>::type
37arity_helper(type_wrapper< F<T1> >, arity_tag<1>);
38
39template<
40      template< typename P1, typename P2 > class F
41    , typename T1, typename T2
42    >
43typename arity_tag<2>::type
44arity_helper(type_wrapper< F< T1,T2 > >, arity_tag<2>);
45
46template<
47      template< typename P1, typename P2, typename P3 > class F
48    , typename T1, typename T2, typename T3
49    >
50typename arity_tag<3>::type
51arity_helper(type_wrapper< F< T1,T2,T3 > >, arity_tag<3>);
52
53template<
54      template< typename P1, typename P2, typename P3, typename P4 > class F
55    , typename T1, typename T2, typename T3, typename T4
56    >
57typename arity_tag<4>::type
58arity_helper(type_wrapper< F< T1,T2,T3,T4 > >, arity_tag<4>);
59
60template<
61      template<
62          typename P1, typename P2, typename P3, typename P4
63        , typename P5
64        >
65      class F
66    , typename T1, typename T2, typename T3, typename T4, typename T5
67    >
68typename arity_tag<5>::type
69arity_helper(type_wrapper< F< T1,T2,T3,T4,T5 > >, arity_tag<5>);
70
71template<
72      template<
73          typename P1, typename P2, typename P3, typename P4
74        , typename P5, typename P6
75        >
76      class F
77    , typename T1, typename T2, typename T3, typename T4, typename T5
78    , typename T6
79    >
80typename arity_tag<6>::type
81arity_helper(type_wrapper< F< T1,T2,T3,T4,T5,T6 > >, arity_tag<6>);
82template< typename F, int N >
83struct template_arity_impl
84{
85    BOOST_STATIC_CONSTANT(int, value =
86          sizeof(arity_helper(type_wrapper<F>(), arity_tag<N>())) - 1
87        );
88};
89
90template< typename F >
91struct template_arity
92{
93    BOOST_STATIC_CONSTANT(int, value  = (
94          max_arity< template_arity_impl< F,1 >::value, template_arity_impl< F,2 >::value, template_arity_impl< F,3 >::value, template_arity_impl< F,4 >::value, template_arity_impl< F,5 >::value, template_arity_impl< F,6 >::value >::value
95
96        ));
97
98    typedef mpl::int_<value> type;
99};
100
101}}}
Note: See TracBrowser for help on using the repository browser.