File indexing completed on 2026-05-03 08:13:09
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___ALGORITHM_RANGES_FILL_H
0010 #define _LIBCPP___ALGORITHM_RANGES_FILL_H
0011
0012 #include <__algorithm/ranges_fill_n.h>
0013 #include <__config>
0014 #include <__iterator/concepts.h>
0015 #include <__ranges/access.h>
0016 #include <__ranges/concepts.h>
0017 #include <__ranges/dangling.h>
0018
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 # pragma GCC system_header
0021 #endif
0022
0023 _LIBCPP_PUSH_MACROS
0024 #include <__undef_macros>
0025
0026 #if _LIBCPP_STD_VER >= 20
0027
0028 _LIBCPP_BEGIN_NAMESPACE_STD
0029
0030 namespace ranges {
0031 struct __fill {
0032 template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent>
0033 _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const {
0034 if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
0035 return ranges::fill_n(__first, __last - __first, __value);
0036 } else {
0037 for (; __first != __last; ++__first)
0038 *__first = __value;
0039 return __first;
0040 }
0041 }
0042
0043 template <class _Type, output_range<const _Type&> _Range>
0044 _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range, const _Type& __value) const {
0045 return (*this)(ranges::begin(__range), ranges::end(__range), __value);
0046 }
0047 };
0048
0049 inline namespace __cpo {
0050 inline constexpr auto fill = __fill{};
0051 }
0052 }
0053
0054 _LIBCPP_END_NAMESPACE_STD
0055
0056 #endif
0057
0058 _LIBCPP_POP_MACROS
0059
0060 #endif