xref: /freebsd/contrib/llvm-project/libcxx/include/__algorithm/ranges_generate.h (revision fcaf7f8644a9988098ac6be2165bce3ea4786e91)
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef _LIBCPP___ALGORITHM_RANGES_GENERATE_H
10 #define _LIBCPP___ALGORITHM_RANGES_GENERATE_H
11 
12 #include <__algorithm/generate.h>
13 #include <__algorithm/make_projected.h>
14 #include <__concepts/constructible.h>
15 #include <__concepts/invocable.h>
16 #include <__config>
17 #include <__functional/identity.h>
18 #include <__functional/invoke.h>
19 #include <__functional/ranges_operations.h>
20 #include <__iterator/concepts.h>
21 #include <__iterator/iterator_traits.h>
22 #include <__iterator/projected.h>
23 #include <__ranges/access.h>
24 #include <__ranges/concepts.h>
25 #include <__ranges/dangling.h>
26 #include <__utility/forward.h>
27 #include <__utility/move.h>
28 
29 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
30 #  pragma GCC system_header
31 #endif
32 
33 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
34 
35 _LIBCPP_BEGIN_NAMESPACE_STD
36 
37 namespace ranges {
38 namespace __generate {
39 
40 struct __fn {
41 
42   template <input_or_output_iterator _OutIter, sentinel_for<_OutIter> _Sent, copy_constructible _Func>
43   requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
44   _LIBCPP_HIDE_FROM_ABI constexpr
45   _OutIter operator()(_OutIter __first, _Sent __last, _Func __gen) const {
46     // TODO: implement
47     (void)__first; (void)__last; (void)__gen;
48     return {};
49   }
50 
51   template <class _Range, copy_constructible _Func>
52   requires invocable<_Func&> && output_range<_Range, invoke_result_t<_Func&>>
53   _LIBCPP_HIDE_FROM_ABI constexpr
54   borrowed_iterator_t<_Range> operator()(_Range&& __range, _Func __gen) const {
55     // TODO: implement
56     (void)__range; (void)__gen;
57     return {};
58   }
59 
60 };
61 
62 } // namespace __generate
63 
64 inline namespace __cpo {
65   inline constexpr auto generate = __generate::__fn{};
66 } // namespace __cpo
67 } // namespace ranges
68 
69 _LIBCPP_END_NAMESPACE_STD
70 
71 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
72 
73 #endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_H
74