aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm/ranges_generate_n.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-07-27 19:50:45 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-07-27 19:50:54 +0000
commit08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (patch)
tree041e72e32710b1e742516d8c9f1575bf0116d3e3 /libcxx/include/__algorithm/ranges_generate_n.h
parent4b4fe385e49bd883fd183b5f21c1ea486c722e61 (diff)
Diffstat (limited to 'libcxx/include/__algorithm/ranges_generate_n.h')
-rw-r--r--libcxx/include/__algorithm/ranges_generate_n.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/libcxx/include/__algorithm/ranges_generate_n.h b/libcxx/include/__algorithm/ranges_generate_n.h
index 7bde5fb4e579..63f466cecdd7 100644
--- a/libcxx/include/__algorithm/ranges_generate_n.h
+++ b/libcxx/include/__algorithm/ranges_generate_n.h
@@ -9,21 +9,16 @@
#ifndef _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H
#define _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H
-#include <__algorithm/generate_n.h>
-#include <__algorithm/make_projected.h>
#include <__concepts/constructible.h>
#include <__concepts/invocable.h>
#include <__config>
#include <__functional/identity.h>
#include <__functional/invoke.h>
-#include <__functional/ranges_operations.h>
#include <__iterator/concepts.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/iterator_traits.h>
-#include <__iterator/projected.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
-#include <__utility/forward.h>
#include <__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -43,9 +38,12 @@ struct __fn {
requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
_LIBCPP_HIDE_FROM_ABI constexpr
_OutIter operator()(_OutIter __first, iter_difference_t<_OutIter> __n, _Func __gen) const {
- // TODO: implement
- (void)__first; (void)__n; (void)__gen;
- return {};
+ for (; __n > 0; --__n) {
+ *__first = __gen();
+ ++__first;
+ }
+
+ return __first;
}
};