aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/include/__algorithm/max_element.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcxx/include/__algorithm/max_element.h')
-rw-r--r--lib/libcxx/include/__algorithm/max_element.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/libcxx/include/__algorithm/max_element.h b/lib/libcxx/include/__algorithm/max_element.h
index b93b67eacf..db29372605 100644
--- a/lib/libcxx/include/__algorithm/max_element.h
+++ b/lib/libcxx/include/__algorithm/max_element.h
@@ -9,24 +9,20 @@
#ifndef _LIBCPP___ALGORITHM_MAX_ELEMENT_H
#define _LIBCPP___ALGORITHM_MAX_ELEMENT_H
-#include <__config>
#include <__algorithm/comp.h>
+#include <__algorithm/comp_ref_type.h>
+#include <__config>
#include <__iterator/iterator_traits.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _ForwardIterator, class _Compare>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-_ForwardIterator
-max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
+template <class _Compare, class _ForwardIterator>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
+__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
{
static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
"std::max_element requires a ForwardIterator");
@@ -40,11 +36,17 @@ max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
return __first;
}
+template <class _ForwardIterator, class _Compare>
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
+max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
+{
+ typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
+ return _VSTD::__max_element<_Comp_ref>(__first, __last, __comp);
+}
+
template <class _ForwardIterator>
-_LIBCPP_NODISCARD_EXT inline
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-_ForwardIterator
+_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last)
{
return _VSTD::max_element(__first, __last,
@@ -53,6 +55,4 @@ max_element(_ForwardIterator __first, _ForwardIterator __last)
_LIBCPP_END_NAMESPACE_STD
-_LIBCPP_POP_MACROS
-
#endif // _LIBCPP___ALGORITHM_MAX_ELEMENT_H