xref: /llvm-project/libcxx/include/__algorithm/ranges_fill_n.h (revision eab7be5d42ad30c9992ff72c3be9298702001dc8)
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_FILL_N_H
10 #define _LIBCPP___ALGORITHM_RANGES_FILL_N_H
11 
12 #include <__algorithm/fill_n.h>
13 #include <__config>
14 #include <__iterator/concepts.h>
15 #include <__iterator/incrementable_traits.h>
16 #include <__utility/move.h>
17 
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 #  pragma GCC system_header
20 #endif
21 
22 _LIBCPP_PUSH_MACROS
23 #include <__undef_macros>
24 
25 #if _LIBCPP_STD_VER >= 20
26 
27 _LIBCPP_BEGIN_NAMESPACE_STD
28 
29 namespace ranges {
30 struct __fill_n {
31   template <class _Type, output_iterator<const _Type&> _Iter>
32   _LIBCPP_HIDE_FROM_ABI constexpr _Iter
33   operator()(_Iter __first, iter_difference_t<_Iter> __n, const _Type& __value) const {
34     return std::__fill_n(std::move(__first), __n, __value);
35   }
36 };
37 
38 inline namespace __cpo {
39 inline constexpr auto fill_n = __fill_n{};
40 } // namespace __cpo
41 } // namespace ranges
42 
43 _LIBCPP_END_NAMESPACE_STD
44 
45 #endif // _LIBCPP_STD_VER >= 20
46 
47 _LIBCPP_POP_MACROS
48 
49 #endif // _LIBCPP___ALGORITHM_RANGES_FILL_N_H
50