boost_no_dep_val_param.ipp 937 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // (C) Copyright John Maddock 2001.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for most recent version.
  6. // MACRO: BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
  7. // TITLE: dependent non-type template parameters
  8. // DESCRIPTION: Template value parameters cannot have a dependent
  9. // type, for example:
  10. // template<class T, typename T::type value>
  11. // class X { ... };
  12. namespace boost_no_dependent_types_in_template_value_parameters{
  13. template <class T, typename T::type value = 0>
  14. class X
  15. {};
  16. template <class T>
  17. struct typifier
  18. {
  19. typedef T type;
  20. };
  21. int test()
  22. {
  23. X<typifier<int> > x;
  24. (void) &x; // avoid "unused variable" warning
  25. return 0;
  26. }
  27. }