File indexing completed on 2025-01-18 10:09:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef RANGES_V3_NUMERIC_IOTA_HPP
0014 #define RANGES_V3_NUMERIC_IOTA_HPP
0015
0016 #include <range/v3/iterator/concepts.hpp>
0017 #include <range/v3/range/access.hpp>
0018 #include <range/v3/range/concepts.hpp>
0019 #include <range/v3/range/dangling.hpp>
0020 #include <range/v3/range/traits.hpp>
0021 #include <range/v3/utility/static_const.hpp>
0022
0023 #include <range/v3/detail/prologue.hpp>
0024
0025 namespace ranges
0026 {
0027
0028
0029 struct iota_fn
0030 {
0031 template(typename O, typename S, typename T)(
0032 requires output_iterator<O, T const &> AND sentinel_for<S, O> AND
0033 weakly_incrementable<T>)
0034 O operator()(O first, S last, T val) const
0035 {
0036 for(; first != last; ++first, ++val)
0037 *first = detail::as_const(val);
0038 return first;
0039 }
0040
0041 template(typename Rng, typename T)(
0042 requires output_range<Rng, T const &> AND weakly_incrementable<T>)
0043 borrowed_iterator_t<Rng> operator()(Rng && rng, T val) const
0044 {
0045 return (*this)(begin(rng), end(rng), detail::move(val));
0046 }
0047 };
0048
0049 RANGES_INLINE_VARIABLE(iota_fn, iota)
0050
0051 }
0052
0053 #include <range/v3/detail/epilogue.hpp>
0054
0055 #endif