CommonMinMax.h 718 B

12345678910111213
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. template<class T> inline
  7. _Post_equal_to_(a < b ? a : b) _Post_satisfies_(return <= a && return <= b)
  8. const T& min(const T& a, const T& b) { return a < b ? a : b; }
  9. template<class T> inline
  10. _Post_equal_to_(a > b ? a : b) _Post_satisfies_(return >= a && return >= b)
  11. const T& max(const T& a, const T& b) { return a > b ? a : b; }