opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
numeric.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <iterator>
6#include <ranges>
7#include <utility>
8
9namespace osc::cpp23
10{
11 template<typename O, typename T>
13
14 template<
15 std::input_or_output_iterator O,
16 std::sentinel_for<O> S,
17 std::weakly_incrementable T
18 >
19 requires std::indirectly_writable<O, const T&>
20 constexpr iota_result<O, T> iota(O first, S last, T value)
21 {
22 while (first != last) {
23 *first = std::as_const(value);
24 ++first;
25 ++value;
26 }
27 return {std::move(first), std::move(value)};
28 }
29
30 template<std::weakly_incrementable T, std::ranges::output_range<const T&> R>
32 {
33 return cpp23::iota(std::ranges::begin(r), std::ranges::end(r), std::move(value));
34 }
35}
Definition algorithm.h:4
constexpr iota_result< O, T > iota(O first, S last, T value)
Definition numeric.h:20
constexpr U to(T &&value)
Definition conversion.h:56
Definition algorithm.h:6