Warning: This file is not a C or C++ file. It does not have highlighting.

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-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___CXX03___ALGORITHM_MAX_H
10#define _LIBCPP___CXX03___ALGORITHM_MAX_H
11
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_header
19#endif
20
21_LIBCPP_PUSH_MACROS
22#include <__cxx03/__undef_macros>
23
24_LIBCPP_BEGIN_NAMESPACE_STD
25
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_STD
39
40_LIBCPP_POP_MACROS
41
42#endif // _LIBCPP___CXX03___ALGORITHM_MAX_H
43

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of libcxx/include/__cxx03/__algorithm/max.h