Horizon
Loading...
Searching...
No Matches
fill.hpp
Go to the documentation of this file.
1
2// Range v3 library
3//
4// Copyright Eric Niebler 2013-present
5//
6// Use, modification and distribution is subject to the
7// Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10//
11// Project home: https://github.com/ericniebler/range-v3
12//
13#ifndef RANGES_V3_ALGORITHM_FILL_HPP
14#define RANGES_V3_ALGORITHM_FILL_HPP
15
17
23#include <range/v3/utility/static_const.hpp>
24
25#include <range/v3/detail/prologue.hpp>
26
27namespace ranges
28{
31 RANGES_FUNC_BEGIN(fill)
32
33
34 template(typename O, typename S, typename V)(
35 requires output_iterator<O, V const &> AND sentinel_for<S, O>)
36 constexpr O RANGES_FUNC(fill)(O first, S last, V const & val) //
37 {
38 for(; first != last; ++first)
39 *first = val;
40 return first;
41 }
42
44 template(typename Rng, typename V)(
46 constexpr borrowed_iterator_t<Rng> RANGES_FUNC(fill)(Rng && rng, V const & val)
47 {
48 return (*this)(begin(rng), end(rng), val);
49 }
50
51 RANGES_FUNC_END(fill)
52
53 namespace cpp20
54 {
55 using ranges::fill;
56 }
58} // namespace ranges
59
60#include <range/v3/detail/epilogue.hpp>
61
62#endif
The output_iterator concept.
The output_range concept.
The sentinel_for concept.