boost_no_template_template.ipp 952 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // (C) Copyright John Maddock 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_NO_TEMPLATE_TEMPLATES
  7. // TITLE: template template paramters.
  8. // DESCRIPTION: Verify that template template parameters both work
  9. // and can be deduced through a function call.
  10. namespace boost_no_template_templates{
  11. template<class T>
  12. class foo
  13. {
  14. public:
  15. foo(){};
  16. foo(const T&){};
  17. const foo& bar()const{ return *this; }
  18. foo& operator=(const foo&){ return *this; }
  19. };
  20. template<typename T, template<typename> class U>
  21. U<T> sinhc_pi(const U<T> x)
  22. {
  23. return x.bar();
  24. }
  25. int test()
  26. {
  27. foo<double> f1;
  28. foo<int> f2;
  29. f1 = sinhc_pi(f1);
  30. f2 = sinhc_pi(f2);
  31. return 0;
  32. }
  33. }