boost_no_mem_tem_keyword.ipp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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_MEMBER_TEMPLATE_KEYWORD
  7. // TITLE: member templates keyword
  8. // DESCRIPTION: Member template keyword not supported.
  9. namespace boost_no_member_template_keyword{
  10. #ifndef BOOST_NO_MEMBER_TEMPLATES
  11. template <class T>
  12. struct foo
  13. {
  14. template <class U>
  15. struct nested
  16. {
  17. typedef foo<U> other;
  18. };
  19. template <class U>
  20. void mfoo(const U&);
  21. };
  22. template <class T>
  23. template <class U>
  24. void foo<T>::mfoo(const U&)
  25. {
  26. }
  27. template <class T>
  28. void test_proc(T i)
  29. {
  30. foo<double> f1;
  31. typedef foo<T> ifoo;
  32. f1.mfoo(i);
  33. f1.template mfoo<T>(i);
  34. typedef typename ifoo::template nested<double> bound_t;
  35. typedef typename bound_t::other other;
  36. other o;
  37. (void) &o; // avoid "unused variable" warning
  38. }
  39. #else
  40. template <class T>
  41. void test_proc(T)
  42. {
  43. }
  44. #endif
  45. int test()
  46. {
  47. test_proc(0);
  48. return 0;
  49. }
  50. }