boost_has_vc6_mem_templ.ipp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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_MSVC6_MEMBER_TEMPLATES
  7. // TITLE: microsoft member templates
  8. // DESCRIPTION: Microsoft Visual C++ 6.0 has enough member
  9. // template idiosyncrasies (being polite) that
  10. // BOOST_NO_MEMBER_TEMPLATES is defined for this compiler.
  11. // BOOST_MSVC6_MEMBER_TEMPLATES is defined to allow
  12. // compiler specific workarounds.
  13. #ifndef BOOST_NESTED_TEMPLATE
  14. #define BOOST_NESTED_TEMPLATE template
  15. #endif
  16. namespace boost_msvc6_member_templates{
  17. template <class T>
  18. struct foo
  19. {
  20. template <class U>
  21. struct nested
  22. {
  23. typedef foo<U> other;
  24. };
  25. template <class U>
  26. void mfoo(const U&)
  27. {
  28. }
  29. };
  30. template <class T>
  31. void vc6_mem_test(T i)
  32. {
  33. foo<double> f1;
  34. typedef foo<T> ifoo;
  35. f1.mfoo(i);
  36. typedef typename ifoo::BOOST_NESTED_TEMPLATE nested<double> bound_t;
  37. typedef typename bound_t::other other;
  38. other o;
  39. (void)o;
  40. }
  41. int test()
  42. {
  43. int i = 0;
  44. vc6_mem_test(i);
  45. return 0;
  46. }
  47. }