diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-11-20 17:36:30 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-11-20 17:36:30 +0000 | 
| commit | 846a2208a8ab099f595fe7e8b2e6d54a7b5e67fb (patch) | |
| tree | 73c1a7a230c8bb19317a3893d937c4d8a219e91c /libcxx/include/__algorithm/min_element.h | |
| parent | c0981da47d5696fe36474fcf86b4ce03ae3ff818 (diff) | |
Diffstat (limited to 'libcxx/include/__algorithm/min_element.h')
| -rw-r--r-- | libcxx/include/__algorithm/min_element.h | 21 | 
1 files changed, 13 insertions, 8 deletions
| diff --git a/libcxx/include/__algorithm/min_element.h b/libcxx/include/__algorithm/min_element.h index 9bfd0793c69d..3aebebca91ab 100644 --- a/libcxx/include/__algorithm/min_element.h +++ b/libcxx/include/__algorithm/min_element.h @@ -11,6 +11,7 @@  #include <__config>  #include <__algorithm/comp.h> +#include <__algorithm/comp_ref_type.h>  #include <__iterator/iterator_traits.h>  #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -19,11 +20,9 @@  _LIBCPP_BEGIN_NAMESPACE_STD -template <class _ForwardIterator, class _Compare> -_LIBCPP_NODISCARD_EXT inline -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -_ForwardIterator -min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +template <class _Compare, class _ForwardIterator> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator +__min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)  {      static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,          "std::min_element requires a ForwardIterator"); @@ -37,10 +36,16 @@ min_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 +min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ +    typedef typename __comp_ref_type<_Compare>::type _Comp_ref; +    return _VSTD::__min_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  min_element(_ForwardIterator __first, _ForwardIterator __last)  {      return _VSTD::min_element(__first, __last, | 
