Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:08

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___ALGORITHM_MIN_H
0010 #define _LIBCPP___ALGORITHM_MIN_H
0011 
0012 #include <__algorithm/comp.h>
0013 #include <__algorithm/comp_ref_type.h>
0014 #include <__algorithm/min_element.h>
0015 #include <__config>
0016 #include <initializer_list>
0017 
0018 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0019 #  pragma GCC system_header
0020 #endif
0021 
0022 _LIBCPP_PUSH_MACROS
0023 #include <__undef_macros>
0024 
0025 _LIBCPP_BEGIN_NAMESPACE_STD
0026 
0027 template <class _Tp, class _Compare>
0028 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
0029 min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
0030   return __comp(__b, __a) ? __b : __a;
0031 }
0032 
0033 template <class _Tp>
0034 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
0035 min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
0036   return std::min(__a, __b, __less<>());
0037 }
0038 
0039 #ifndef _LIBCPP_CXX03_LANG
0040 
0041 template <class _Tp, class _Compare>
0042 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp
0043 min(initializer_list<_Tp> __t, _Compare __comp) {
0044   return *std::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
0045 }
0046 
0047 template <class _Tp>
0048 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) {
0049   return *std::min_element(__t.begin(), __t.end(), __less<>());
0050 }
0051 
0052 #endif // _LIBCPP_CXX03_LANG
0053 
0054 _LIBCPP_END_NAMESPACE_STD
0055 
0056 _LIBCPP_POP_MACROS
0057 
0058 #endif // _LIBCPP___ALGORITHM_MIN_H