boost_no_ded_typename.ipp 781 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // (C) Copyright John Maddock and Dave Abrahams 2002.
  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_DEDUCED_TYPENAME
  7. // TITLE: deduced typenames
  8. // DESCRIPTION: Some compilers can't use the typename keyword in deduced contexts.
  9. #ifndef BOOST_DEDUCED_TYPENAME
  10. #define BOOST_DEDUCED_TYPENAME typename
  11. #endif
  12. namespace boost_deduced_typename{
  13. template <class T>
  14. int f(T const volatile*, BOOST_DEDUCED_TYPENAME T::type* = 0)
  15. {
  16. return 0;
  17. }
  18. struct X { typedef int type; };
  19. int test()
  20. {
  21. return f((X*)0);
  22. }
  23. }