File indexing completed on 2025-12-16 10:27:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef RANGES_V3_ALGORITHM_FILL_HPP
0014 #define RANGES_V3_ALGORITHM_FILL_HPP
0015
0016 #include <range/v3/range_fwd.hpp>
0017
0018 #include <range/v3/iterator/concepts.hpp>
0019 #include <range/v3/range/access.hpp>
0020 #include <range/v3/range/concepts.hpp>
0021 #include <range/v3/range/dangling.hpp>
0022 #include <range/v3/range/traits.hpp>
0023 #include <range/v3/utility/static_const.hpp>
0024
0025 #include <range/v3/detail/prologue.hpp>
0026
0027 namespace ranges
0028 {
0029
0030
0031 RANGES_FUNC_BEGIN(fill)
0032
0033
0034 template(typename O, typename S, typename V)(
0035 requires output_iterator<O, V const &> AND sentinel_for<S, O>)
0036 constexpr O RANGES_FUNC(fill)(O first, S last, V const & val)
0037 {
0038 for(; first != last; ++first)
0039 *first = val;
0040 return first;
0041 }
0042
0043
0044 template(typename Rng, typename V)(
0045 requires output_range<Rng, V const &>)
0046 constexpr borrowed_iterator_t<Rng> RANGES_FUNC(fill)(Rng && rng, V const & val)
0047 {
0048 return (*this)(begin(rng), end(rng), val);
0049 }
0050
0051 RANGES_FUNC_END(fill)
0052
0053 namespace cpp20
0054 {
0055 using ranges::fill;
0056 }
0057
0058 }
0059
0060 #include <range/v3/detail/epilogue.hpp>
0061
0062 #endif