From 8286ac511144e4f17d34eac9affb97e50646344a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:25:44 +0200 Subject: Imported Upstream version 4.0.0 --- .../cutl/details/boost/mpl/aux_/template_arity.hpp | 189 +++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 libcutl/cutl/details/boost/mpl/aux_/template_arity.hpp (limited to 'libcutl/cutl/details/boost/mpl/aux_/template_arity.hpp') diff --git a/libcutl/cutl/details/boost/mpl/aux_/template_arity.hpp b/libcutl/cutl/details/boost/mpl/aux_/template_arity.hpp new file mode 100644 index 0000000..5f697a9 --- /dev/null +++ b/libcutl/cutl/details/boost/mpl/aux_/template_arity.hpp @@ -0,0 +1,189 @@ + +#if !defined(BOOST_PP_IS_ITERATING) + +///// header body + +#ifndef BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED +#define BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: template_arity.hpp 61584 2010-04-26 18:48:26Z agurtovoy $ +// $Date: 2010-04-26 11:48:26 -0700 (Mon, 26 Apr 2010) $ +// $Revision: 61584 $ + +#include +#include + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +# include +# include +# if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT) +# if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) +# include +# endif +# else +# include +# endif +#endif + +#include +#include + +#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) + +# define BOOST_MPL_PREPROCESSED_HEADER template_arity.hpp +# include + +#else + +# if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT) +# if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) + +# include +# include +# include +# include +# include + +# include +# include +# include +# include +# include + +# define AUX778076_ARITY BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) + +namespace cutl_details_boost { namespace mpl { namespace aux { + +template< BOOST_MPL_AUX_NTTP_DECL(int, N) > struct arity_tag +{ + typedef char (&type)[N + 1]; +}; + +# define AUX778076_MAX_ARITY_OP(unused, state, i_) \ + ( BOOST_PP_CAT(C,i_) > 0 ? BOOST_PP_CAT(C,i_) : state ) \ +/**/ + +template< + BOOST_MPL_PP_PARAMS(AUX778076_ARITY, BOOST_MPL_AUX_NTTP_DECL(int, C)) + > +struct max_arity +{ + BOOST_STATIC_CONSTANT(int, value = + BOOST_PP_SEQ_FOLD_LEFT( + AUX778076_MAX_ARITY_OP + , -1 + , BOOST_MPL_PP_RANGE(1, AUX778076_ARITY) + ) + ); +}; + +# undef AUX778076_MAX_ARITY_OP + +arity_tag<0>::type arity_helper(...); + +# define BOOST_PP_ITERATION_LIMITS (1, AUX778076_ARITY) +# define BOOST_PP_FILENAME_1 +# include BOOST_PP_ITERATE() + +template< typename F, BOOST_MPL_AUX_NTTP_DECL(int, N) > +struct template_arity_impl +{ + BOOST_STATIC_CONSTANT(int, value = + sizeof(::cutl_details_boost::mpl::aux::arity_helper(type_wrapper(),arity_tag())) - 1 + ); +}; + +# define AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION(unused, i_, F) \ + BOOST_PP_COMMA_IF(i_) template_arity_impl::value \ +/**/ + +template< typename F > +struct template_arity +{ + BOOST_STATIC_CONSTANT(int, value = ( + max_arity< BOOST_MPL_PP_REPEAT( + AUX778076_ARITY + , AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION + , F + ) >::value + )); + + typedef mpl::int_ type; +}; + +# undef AUX778076_TEMPLATE_ARITY_IMPL_INVOCATION + +# undef AUX778076_ARITY + +}}} + +# endif // BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING +# else // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT + +# include + +namespace cutl_details_boost { namespace mpl { namespace aux { + +template< bool > +struct template_arity_impl +{ + template< typename F > struct result_ + : mpl::int_<-1> + { + }; +}; + +template<> +struct template_arity_impl +{ + template< typename F > struct result_ + : F::arity + { + }; +}; + +template< typename F > +struct template_arity + : template_arity_impl< ::cutl_details_boost::mpl::aux::has_rebind::value > + ::template result_ +{ +}; + +#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG) +template<> +struct template_arity + : mpl::int_<-1> +{ +}; +#endif + +}}} + +# endif // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT + +#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif // BOOST_MPL_AUX_TEMPLATE_ARITY_HPP_INCLUDED + +///// iteration + +#else +#define i_ BOOST_PP_FRAME_ITERATION(1) + +template< + template< BOOST_MPL_PP_PARAMS(i_, typename P) > class F + , BOOST_MPL_PP_PARAMS(i_, typename T) + > +typename arity_tag::type +arity_helper(type_wrapper< F >, arity_tag); + +#undef i_ +#endif // BOOST_PP_IS_ITERATING -- cgit v1.2.3