boost_no_using_template.ipp 1021 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_USING_TEMPLATE
  7. // TITLE: using template declarations
  8. // DESCRIPTION: The compiler will not accept a using declaration
  9. // that imports a class or function template
  10. // into a named namespace. Probably Borland/MSVC6 specific.
  11. template <class T>
  12. int global_foo(T)
  13. {
  14. return 0;
  15. }
  16. template <class T, class U = void>
  17. struct op
  18. {
  19. friend op<T,U> operator +(const op&, const op&)
  20. {
  21. return op();
  22. };
  23. };
  24. namespace boost_no_using_template{
  25. using ::global_foo;
  26. using ::op;
  27. int test()
  28. {
  29. boost_no_using_template::op<int, int> a;
  30. boost_no_using_template::op<int, int> b;
  31. a+b;
  32. return boost_no_using_template::global_foo(0);
  33. }
  34. }