boost_no_function_template_default_args.ipp 906 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // (C) Copyright Mathias Gaunard 2009.
  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 the most recent version.
  6. // MACRO: BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  7. // TITLE: Default template arguments for function templates
  8. // DESCRIPTION: Default template arguments for function templates are not supported.
  9. namespace boost_no_cxx11_function_template_default_args
  10. {
  11. template<typename T = int>
  12. T foo()
  13. {
  14. return 0;
  15. }
  16. template<typename T, typename U>
  17. bool is_same(T, U)
  18. {
  19. return false;
  20. }
  21. template<typename T>
  22. bool is_same(T, T)
  23. {
  24. return true;
  25. }
  26. int test()
  27. {
  28. return !is_same(foo<>(), 0) || is_same(foo<>(), 0L);
  29. }
  30. } // namespace boost_no_function_template_default_args