brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 0a2e435 Raw
43 lines · c
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef _LIBCPP___CXX03___ALGORITHM_MAX_H10#define _LIBCPP___CXX03___ALGORITHM_MAX_H11 12#include <__cxx03/__algorithm/comp.h>13#include <__cxx03/__algorithm/comp_ref_type.h>14#include <__cxx03/__algorithm/max_element.h>15#include <__cxx03/__config>16 17#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18#  pragma GCC system_header19#endif20 21_LIBCPP_PUSH_MACROS22#include <__cxx03/__undef_macros>23 24_LIBCPP_BEGIN_NAMESPACE_STD25 26template <class _Tp, class _Compare>27_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI const _Tp&28max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) {29  return __comp(__a, __b) ? __b : __a;30}31 32template <class _Tp>33_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI const _Tp&34max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) {35  return std::max(__a, __b, __less<>());36}37 38_LIBCPP_END_NAMESPACE_STD39 40_LIBCPP_POP_MACROS41 42#endif // _LIBCPP___CXX03___ALGORITHM_MAX_H43