181ad6265SDimitry Andric //===----------------------------------------------------------------------===// 281ad6265SDimitry Andric // 381ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 481ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 581ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 681ad6265SDimitry Andric // 781ad6265SDimitry Andric //===----------------------------------------------------------------------===// 881ad6265SDimitry Andric 981ad6265SDimitry Andric #ifndef _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H 1081ad6265SDimitry Andric #define _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H 1181ad6265SDimitry Andric 1281ad6265SDimitry Andric #include <__algorithm/iterator_operations.h> 1381ad6265SDimitry Andric #include <__algorithm/lower_bound.h> 1481ad6265SDimitry Andric #include <__config> 1581ad6265SDimitry Andric #include <__functional/identity.h> 1681ad6265SDimitry Andric #include <__functional/invoke.h> 1781ad6265SDimitry Andric #include <__functional/ranges_operations.h> 1881ad6265SDimitry Andric #include <__iterator/advance.h> 1981ad6265SDimitry Andric #include <__iterator/concepts.h> 2081ad6265SDimitry Andric #include <__iterator/iterator_traits.h> 2181ad6265SDimitry Andric #include <__iterator/projected.h> 2281ad6265SDimitry Andric #include <__ranges/access.h> 2381ad6265SDimitry Andric #include <__ranges/concepts.h> 2481ad6265SDimitry Andric #include <__ranges/dangling.h> 2581ad6265SDimitry Andric 2681ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 2781ad6265SDimitry Andric # pragma GCC system_header 2881ad6265SDimitry Andric #endif 2981ad6265SDimitry Andric 30b3edf446SDimitry Andric _LIBCPP_PUSH_MACROS 31b3edf446SDimitry Andric #include <__undef_macros> 32b3edf446SDimitry Andric 3306c3fb27SDimitry Andric #if _LIBCPP_STD_VER >= 20 3481ad6265SDimitry Andric 3581ad6265SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD 3681ad6265SDimitry Andric 3781ad6265SDimitry Andric namespace ranges { 3881ad6265SDimitry Andric 3981ad6265SDimitry Andric namespace __lower_bound { 4081ad6265SDimitry Andric struct __fn { 4106c3fb27SDimitry Andric template <forward_iterator _Iter, 4206c3fb27SDimitry Andric sentinel_for<_Iter> _Sent, 4306c3fb27SDimitry Andric class _Type, 4406c3fb27SDimitry Andric class _Proj = identity, 4581ad6265SDimitry Andric indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less> 46*0fca6ea1SDimitry Andric [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Iter 4706c3fb27SDimitry Andric operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { 4806c3fb27SDimitry Andric return std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj); 4981ad6265SDimitry Andric } 5081ad6265SDimitry Andric 5106c3fb27SDimitry Andric template <forward_range _Range, 5206c3fb27SDimitry Andric class _Type, 5306c3fb27SDimitry Andric class _Proj = identity, 5481ad6265SDimitry Andric indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less> 55*0fca6ea1SDimitry Andric [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> 5606c3fb27SDimitry Andric operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { 5706c3fb27SDimitry Andric return std::__lower_bound<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __comp, __proj); 5881ad6265SDimitry Andric } 5981ad6265SDimitry Andric }; 6081ad6265SDimitry Andric } // namespace __lower_bound 6181ad6265SDimitry Andric 6281ad6265SDimitry Andric inline namespace __cpo { 6381ad6265SDimitry Andric inline constexpr auto lower_bound = __lower_bound::__fn{}; 6481ad6265SDimitry Andric } // namespace __cpo 6581ad6265SDimitry Andric } // namespace ranges 6681ad6265SDimitry Andric 6781ad6265SDimitry Andric _LIBCPP_END_NAMESPACE_STD 6881ad6265SDimitry Andric 6906c3fb27SDimitry Andric #endif // _LIBCPP_STD_VER >= 20 7081ad6265SDimitry Andric 71b3edf446SDimitry Andric _LIBCPP_POP_MACROS 72b3edf446SDimitry Andric 7381ad6265SDimitry Andric #endif // _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H 74