File indexing completed on 2026-05-03 08:13:08
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___ALGORITHM_MAX_H
0010 #define _LIBCPP___ALGORITHM_MAX_H
0011
0012 #include <__algorithm/comp.h>
0013 #include <__algorithm/comp_ref_type.h>
0014 #include <__algorithm/max_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 max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {
0030 return __comp(__a, __b) ? __b : __a;
0031 }
0032
0033 template <class _Tp>
0034 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&
0035 max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {
0036 return std::max(__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 max(initializer_list<_Tp> __t, _Compare __comp) {
0044 return *std::__max_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 max(initializer_list<_Tp> __t) {
0049 return *std::max_element(__t.begin(), __t.end(), __less<>());
0050 }
0051
0052 #endif
0053
0054 _LIBCPP_END_NAMESPACE_STD
0055
0056 _LIBCPP_POP_MACROS
0057
0058 #endif