arity_spec.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef BOOST_MPL_AUX_ARITY_SPEC_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_ARITY_SPEC_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2001-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/int.hpp>
  14. #include <boost/mpl/limits/arity.hpp>
  15. #include <boost/mpl/aux_/config/dtp.hpp>
  16. #include <boost/mpl/aux_/preprocessor/params.hpp>
  17. #include <boost/mpl/aux_/arity.hpp>
  18. #include <boost/mpl/aux_/template_arity_fwd.hpp>
  19. #include <boost/mpl/aux_/config/ttp.hpp>
  20. #include <boost/mpl/aux_/config/lambda.hpp>
  21. #include <boost/mpl/aux_/config/static_constant.hpp>
  22. #if defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
  23. # define BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(i,type,name) \
  24. namespace aux { \
  25. template< BOOST_MPL_AUX_NTTP_DECL(int, N), BOOST_MPL_PP_PARAMS(i,type T) > \
  26. struct arity< \
  27. name< BOOST_MPL_PP_PARAMS(i,T) > \
  28. , N \
  29. > \
  30. { \
  31. BOOST_STATIC_CONSTANT(int \
  32. , value = BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
  33. ); \
  34. }; \
  35. } \
  36. /**/
  37. #else
  38. # define BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(i,type,name) /**/
  39. #endif
  40. # define BOOST_MPL_AUX_ARITY_SPEC(i,name) \
  41. BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(i,typename,name) \
  42. /**/
  43. #if defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) \
  44. && !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT)
  45. # define BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(i, name) \
  46. namespace aux { \
  47. template< BOOST_MPL_PP_PARAMS(i,typename T) > \
  48. struct template_arity< name<BOOST_MPL_PP_PARAMS(i,T)> > \
  49. : int_<i> \
  50. { \
  51. }; \
  52. } \
  53. /**/
  54. #else
  55. # define BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(i, name) /**/
  56. #endif
  57. #endif // BOOST_MPL_AUX_ARITY_SPEC_HPP_INCLUDED