template_arity.cpp 877 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright Aleksey Gurtovoy 2000-2004
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/mpl for documentation.
  8. // $Id$
  9. // $Date$
  10. // $Revision$
  11. #include <boost/mpl/aux_/template_arity.hpp>
  12. #include <boost/mpl/aux_/test.hpp>
  13. #if defined(BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
  14. struct my {};
  15. template< typename T1 > struct my1 {};
  16. template< typename T1, typename T2 = void > struct my2 {};
  17. MPL_TEST_CASE()
  18. {
  19. MPL_ASSERT_RELATION( (aux::template_arity<my>::value), ==, -1 );
  20. MPL_ASSERT_RELATION( (aux::template_arity< my1<int> >::value), ==, 1 );
  21. MPL_ASSERT_RELATION( (aux::template_arity< my2<int,long> >::value), ==, 2 );
  22. MPL_ASSERT_RELATION( (aux::template_arity< my2<int> >::value), ==, 2 );
  23. }
  24. #endif