From 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 27 Jul 2022 21:50:45 +0200 Subject: Vendor import of llvm-project main llvmorg-15-init-17826-g1f8ae9d7e7e4, the last commit before the upstream release/16.x branch was created. --- libcxx/include/__algorithm/ranges_generate_n.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libcxx/include/__algorithm/ranges_generate_n.h') 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; } }; -- cgit v1.2.3