boost_no_std_min_max.ipp 756 B

123456789101112131415161718192021222324252627282930313233
  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 the most recent version.
  6. // MACRO: BOOST_NO_STD_MIN_MAX
  7. // TITLE: std::min and std::max
  8. // DESCRIPTION: The C++ standard library does not provide
  9. // the (min)() and (max)() template functions that
  10. // should be in <algorithm>.
  11. #include <algorithm>
  12. namespace boost_no_std_min_max{
  13. int test()
  14. {
  15. int i = 0;
  16. int j = 2;
  17. if((std::min)(i,j) != 0) return -1;
  18. if((std::max)(i,j) != 2) return -1;
  19. return 0;
  20. }
  21. }