template_arity.hpp
Go to the documentation of this file.
1 
2 #if !defined(BOOST_PP_IS_ITERATING)
3 
5 
6 #ifndef BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
7 #define BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
8 
9 // Copyright Aleksey Gurtovoy 2001-2004
10 //
11 // Distributed under the Boost Software License, Version 1.0.
12 // (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14 //
15 // See http://www.boost.org/libs/mpl for documentation.
16 
17 // $Id: template_arity.hpp 13472 2017-08-22 07:53:44Z richean $
18 // $Date: 2017-08-22 09:53:44 +0200 (Di, 22 Aug 2017) $
19 // $Revision: 13472 $
20 
23 
24 #if !defined(BOOST_MPL_PREPROCESSING_MODE)
26 # include <boost/mpl/int.hpp>
27 # if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
28 # if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
30 # endif
31 # else
33 # endif
34 #endif
35 
38 
39 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
40  && !defined(BOOST_MPL_PREPROCESSING_MODE)
41 
42 # define BOOST_MPL_PREPROCESSED_HEADER template_arity.hpp
44 
45 #else
46 
47 # if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
48 # if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
49 
55 
61 
62 # define AUX778076_ARITY BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
63 
64 namespace boost { namespace mpl { namespace aux {
65 
66 template< BOOST_MPL_AUX_NTTP_DECL(int, N) > struct arity_tag
67 {
68  typedef char (&type)[N + 1];
69 };
70 
71 # define AUX778076_MAX_ARITY_OP(unused, state, i_) \
72  ( BOOST_PP_CAT(C,i_) > 0 ? BOOST_PP_CAT(C,i_) : state ) \
73 
74 
75 template<
76  BOOST_MPL_PP_PARAMS(AUX778076_ARITY, BOOST_MPL_AUX_NTTP_DECL(int, C))
77  >
78 struct max_arity
79 {
80  BOOST_STATIC_CONSTANT(int, value =
82  AUX778076_MAX_ARITY_OP
83  , -1
84  , BOOST_MPL_PP_RANGE(1, AUX778076_ARITY)
85  )
86  );
87 };
88 
89 # undef AUX778076_MAX_ARITY_OP
90 
92 
93 # define BOOST_PP_ITERATION_LIMITS (1, AUX778076_ARITY)
94 # define BOOST_PP_FILENAME_1 <boost/mpl/aux_/template_arity.hpp>
95 # include BOOST_PP_ITERATE()
96 
97 template< typename F, BOOST_MPL_AUX_NTTP_DECL(int, N) >
98 struct template_arity_impl
99 {
100  BOOST_STATIC_CONSTANT(int, value =
101  sizeof(::boost::mpl::aux::arity_helper(type_wrapper<F>(),arity_tag<N>())) - 1
102  );
103 };
104 
105 # define AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION(unused, i_, F) \
106  BOOST_PP_COMMA_IF(i_) template_arity_impl<F,BOOST_PP_INC(i_)>::value \
107 
108 
109 template< typename F >
110 struct template_arity
111 {
112  BOOST_STATIC_CONSTANT(int, value = (
113  max_arity< BOOST_MPL_PP_REPEAT(
114  AUX778076_ARITY
115  , AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION
116  , F
117  ) >::value
118  ));
119 
120  typedef mpl::int_<value> type;
121 };
122 
123 # undef AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION
124 
125 # undef AUX778076_ARITY
126 
127 }}}
128 
129 # endif // BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING
130 # else // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
131 
133 
134 namespace boost { namespace mpl { namespace aux {
135 
136 template< bool >
137 struct template_arity_impl
138 {
139  template< typename F > struct result_
140  : mpl::int_<-1>
141  {
142  };
143 };
144 
145 template<>
146 struct template_arity_impl<true>
147 {
148  template< typename F > struct result_
149  : F::arity
150  {
151  };
152 };
153 
154 template< typename F >
155 struct template_arity
156  : template_arity_impl< ::boost::mpl::aux::has_rebind<F>::value >
157  ::template result_<F>
158 {
159 };
160 
161 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
162 template<>
163 struct template_arity<int>
164  : mpl::int_<-1>
165 {
166 };
167 #endif
168 
169 }}}
170 
171 # endif // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT
172 
173 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
174 #endif // BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED
175 
177 
178 #else
179 #define i_ BOOST_PP_FRAME_ITERATION(1)
180 
181 template<
182  template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F
183  , BOOST_MPL_PP_PARAMS(i_, typename T)
184  >
185 typename arity_tag<i_>::type
186 arity_helper(type_wrapper< F<BOOST_MPL_PP_PARAMS(i_, T)> >, arity_tag<i_>);
187 
188 #undef i_
189 #endif // BOOST_PP_IS_ITERATING
has_rebind.hpp
boost::mpl::aux::arity_helper
arity_tag< 0 >::type arity_helper(...)
T
T
Definition: mem_fn_cc.hpp:25
use_preprocessed.hpp
BOOST_PP_SEQ_FOLD_LEFT
#define BOOST_PP_SEQ_FOLD_LEFT
Definition: seq/fold_left.hpp:29
BOOST_MPL_PP_REPEAT
#define BOOST_MPL_PP_REPEAT(n, f, param)
Definition: mpl/aux_/preprocessor/repeat.hpp:23
template_arity_fwd.hpp
BOOST_MPL_PP_PARAMS
#define BOOST_MPL_PP_PARAMS(n, p)
Definition: params.hpp:28
boost::mpl::aux::arity_tag::type
char(& type)[N+1]
Definition: preprocessed/gcc/template_arity.hpp:15
BOOST_MPL_AUX_NTTP_DECL
#define BOOST_MPL_AUX_NTTP_DECL(T, x)
Definition: nttp_decl.hpp:31
lambda.hpp
int.hpp
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::mpl::aux::max_arity::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(int, value=(C6 > 0 ? C6 :(C5 > 0 ? C5 :(C4 > 0 ? C4 :(C3 > 0 ? C3 :(C2 > 0 ? C2 :(C1 > 0 ? C1 :-1)))))))
arity.hpp
cat.hpp
type_wrapper.hpp
ttp.hpp
inc.hpp
boost::mpl::aux::template_arity::type
mpl::int_< value > type
Definition: preprocessed/gcc/template_arity.hpp:94
nttp_decl.hpp
fold_left.hpp
range.hpp
eti.hpp
boost::mpl::aux::template_arity_impl::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(int, value=sizeof(::boost::mpl::aux::arity_helper(type_wrapper< F >(), arity_tag< N >())) - 1)
include_preprocessed.hpp
params.hpp
repeat.hpp
comma_if.hpp
BOOST_MPL_PP_RANGE
#define BOOST_MPL_PP_RANGE(first, length)
Definition: range.hpp:23
static_constant.hpp
boost::mpl::aux::template_arity::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(int, value=(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))
iterate.hpp


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:48:42