58 lines · c
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H10#define _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H11 12#include <__algorithm/generate_n.h>13#include <__concepts/constructible.h>14#include <__concepts/invocable.h>15#include <__config>16#include <__functional/identity.h>17#include <__iterator/concepts.h>18#include <__iterator/incrementable_traits.h>19#include <__iterator/iterator_traits.h>20#include <__ranges/access.h>21#include <__ranges/concepts.h>22#include <__type_traits/invoke.h>23#include <__utility/move.h>24 25#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)26# pragma GCC system_header27#endif28 29_LIBCPP_PUSH_MACROS30#include <__undef_macros>31 32#if _LIBCPP_STD_VER >= 2033 34_LIBCPP_BEGIN_NAMESPACE_STD35 36namespace ranges {37struct __generate_n {38 template <input_or_output_iterator _OutIter, copy_constructible _Func>39 requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>40 _LIBCPP_HIDE_FROM_ABI constexpr _OutIter41 operator()(_OutIter __first, iter_difference_t<_OutIter> __n, _Func __gen) const {42 return std::__generate_n(std::move(__first), __n, __gen);43 }44};45 46inline namespace __cpo {47inline constexpr auto generate_n = __generate_n{};48} // namespace __cpo49} // namespace ranges50 51_LIBCPP_END_NAMESPACE_STD52 53#endif // _LIBCPP_STD_VER >= 2054 55_LIBCPP_POP_MACROS56 57#endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H58