di 0.1.0
Loading...
Searching...
No Matches
generate_n.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace di::container {
8namespace detail {
9 struct GenerateNFunction {
10 template<concepts::Iterator Out, typename SSizeType = meta::IteratorSSizeType<Out>,
11 concepts::CopyConstructible F>
12 requires(concepts::Invocable<F&> && concepts::IndirectlyWritable<Out, meta::InvokeResult<F&>>)
13 constexpr auto operator()(Out output, meta::TypeIdentity<SSizeType> n, F gen) const -> Out {
14 for (SSizeType i = 0; i < n; ++i, ++output) {
15 *output = function::invoke(gen);
16 }
17 return output;
18 }
19 };
20}
21
22constexpr inline auto generate_n = detail::GenerateNFunction {};
23}
Definition sequence.h:12
constexpr auto generate_n
Definition generate_n.h:22
constexpr auto invoke
Definition invoke.h:100
Type< TypeConstant< T > > TypeIdentity
This is a helper template to prevent C++ from deducing the type of template argument.
Definition core.h:32