boost_no_cxx14_return_type_ded.ipp 678 B

1234567891011121314151617181920212223242526272829
  1. // (C) Copyright Kohei Takahashi 2014
  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 more information.
  6. // MACRO: BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
  7. // TITLE: C++14 return type deduction unavailable
  8. // DESCRIPTION: The compiler does not support C++14 return type deduction
  9. namespace boost_no_cxx14_return_type_deduction
  10. {
  11. template<typename T>
  12. auto deduced_abs(T x)
  13. {
  14. return x > 0 ? x : -x;
  15. }
  16. int test()
  17. {
  18. return deduced_abs(2) - deduced_abs(-2);
  19. }
  20. }