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