Horizon
fill.hpp
Go to the documentation of this file.
1 // 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 
16 #include <range/v3/range_fwd.hpp>
17 
23 #include <range/v3/utility/static_const.hpp>
24 
25 #include <range/v3/detail/prologue.hpp>
26 
27 namespace 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)(
45  requires output_range<Rng, V const &>)
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
template(typename Rng, typename V)(requires output_range< Rng
This is an overloaded member function, provided for convenience. It differs from the above function o...
CPP_concept sentinel_for
\concept sentinel_for
Definition: concepts.hpp:306
CPP_concept output_iterator
\concept output_iterator
Definition: concepts.hpp:347
front< Pair > first
Retrieve the first element of the pair Pair.
Definition: meta.hpp:2251