Horizon
Loading...
Searching...
No Matches
iota.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_NUMERIC_IOTA_HPP
14#define RANGES_V3_NUMERIC_IOTA_HPP
15
21#include <range/v3/utility/static_const.hpp>
22
23#include <range/v3/detail/prologue.hpp>
24
25namespace ranges
26{
29 struct iota_fn
30 {
31 template(typename O, typename S, typename T)(
34 O operator()(O first, S last, T val) const
35 {
36 for(; first != last; ++first, ++val)
37 *first = detail::as_const(val);
38 return first;
39 }
40
41 template(typename Rng, typename T)(
43 borrowed_iterator_t<Rng> operator()(Rng && rng, T val) const //
44 {
45 return (*this)(begin(rng), end(rng), detail::move(val));
46 }
47 };
48
49 RANGES_INLINE_VARIABLE(iota_fn, iota)
51} // namespace ranges
52
53#include <range/v3/detail/epilogue.hpp>
54
55#endif
The output_iterator concept.
The output_range concept.
The sentinel_for concept.
The weakly_incrementable concept.
Definition iota.hpp:30