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_N_HPP
0014 #define RANGES_V3_ALGORITHM_FILL_N_HPP
0015
0016 #include <utility>
0017
0018 #include <range/v3/range_fwd.hpp>
0019
0020 #include <range/v3/iterator/concepts.hpp>
0021 #include <range/v3/iterator/operations.hpp>
0022 #include <range/v3/range/access.hpp>
0023 #include <range/v3/range/concepts.hpp>
0024 #include <range/v3/range/traits.hpp>
0025 #include <range/v3/utility/static_const.hpp>
0026
0027 #include <range/v3/detail/prologue.hpp>
0028
0029 namespace ranges
0030 {
0031
0032
0033 RANGES_FUNC_BEGIN(fill_n)
0034
0035
0036 template(typename O, typename V)(
0037 requires output_iterator<O, V const &>)
0038 constexpr O RANGES_FUNC(fill_n)(O first, iter_difference_t<O> n, V const & val)
0039 {
0040 RANGES_EXPECT(n >= 0);
0041 auto norig = n;
0042 auto b = uncounted(first);
0043 for(; n != 0; ++b, --n)
0044 *b = val;
0045 return recounted(first, b, norig);
0046 }
0047
0048 RANGES_FUNC_END(fill_n)
0049
0050 namespace cpp20
0051 {
0052 using ranges::fill_n;
0053 }
0054
0055 }
0056
0057 #include <range/v3/detail/epilogue.hpp>
0058
0059 #endif