[libcxx-commits] [libcxx] [libc++] Added segmented iterator for std::fill (PR #104680)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Oct 6 02:46:05 PDT 2024
https://github.com/NoumanAmir657 updated https://github.com/llvm/llvm-project/pull/104680
>From e395a59f8da17ae3775947c1fd29822dac241c9e Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sat, 17 Aug 2024 23:18:52 +0500
Subject: [PATCH 01/24] [libcxx] Added segment iterator for fill
---
libcxx/include/__algorithm/fill.h | 53 +++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 6 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 1ce3eadb013d05..3ba37e7260a4a2 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -21,25 +21,66 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
-template <class _ForwardIterator, class _Tp>
+template <
+ class _ForwardIterator,
+ class _Tp,
+ __enable_if_t<
+ is_same<typename iterator_traits<_ForwardIterator>::iterator_category, forward_iterator_tag>::value ||
+ is_same<typename iterator_traits<_ForwardIterator>::iterator_category, bidirectional_iterator_tag>::value,
+ int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
-__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag) {
+__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
for (; __first != __last; ++__first)
*__first = __value;
}
-template <class _RandomAccessIterator, class _Tp>
+template <class _RandomAccessIterator,
+ class _Tp,
+ __enable_if_t<(is_same<typename iterator_traits<_RandomAccessIterator>::iterator_category,
+ random_access_iterator_tag>::value ||
+ is_same<typename iterator_traits<_RandomAccessIterator>::iterator_category,
+ contiguous_iterator_tag>::value) &&
+ !__is_segmented_iterator<_RandomAccessIterator>::value,
+ int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
-__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag) {
+__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value) {
std::fill_n(__first, __last - __first, __value);
}
+template <class _SegmentedIterator,
+ class _Tp,
+ __enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
+ using _Traits = __segmented_iterator_traits<_SegmentedIterator>;
+
+ auto __sfirst = _Traits::__segment(__first);
+ auto __slast = _Traits::__segment(__last);
+
+ // We are in a single segment, so we might not be at the beginning or end
+ if (__sfirst == __slast) {
+ __fill(_Traits::__local(__first), _Traits::__local(__last), __value);
+ return;
+ }
+
+ // We have more than one segment. Iterate over the first segment, since we might not start at the beginning
+ __fill(_Traits::__local(__first), _Traits::__end(__sfirst), __value);
+ ++__sfirst;
+ // iterate over the segments which are guaranteed to be completely in the range
+ while (__sfirst != __slast) {
+ __fill(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), __value);
+ ++__sfirst;
+ }
+ // iterate over the last segment
+ __fill(_Traits::__begin(__sfirst), _Traits::__local(__last), __value);
+}
+
template <class _ForwardIterator, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
- std::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
+ std::__fill(__first, __last, __value);
}
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP___ALGORITHM_FILL_H
+#endif // _LIBCPP___ALGORITHM_FILL_H
\ No newline at end of file
>From d35ce6c136b709b87633c833b026776272194b06 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sat, 17 Aug 2024 23:37:14 +0500
Subject: [PATCH 02/24] Fixed newline
---
libcxx/include/__algorithm/fill.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 3ba37e7260a4a2..da2bda4713c373 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -83,4 +83,4 @@ fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP___ALGORITHM_FILL_H
\ No newline at end of file
+#endif // _LIBCPP___ALGORITHM_FILL_H
>From cd3af273a2dc55147fc28e2bdbbbc276df78e821 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 18 Aug 2024 00:57:05 +0500
Subject: [PATCH 03/24] Fixed the logic of templates
---
libcxx/include/__algorithm/fill.h | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index da2bda4713c373..b8d893e2ee7339 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -12,6 +12,7 @@
#include <__algorithm/fill_n.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__iterator/segmented_iterator.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -24,10 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <
class _ForwardIterator,
class _Tp,
- __enable_if_t<
- is_same<typename iterator_traits<_ForwardIterator>::iterator_category, forward_iterator_tag>::value ||
- is_same<typename iterator_traits<_ForwardIterator>::iterator_category, bidirectional_iterator_tag>::value,
- int> = 0>
+ __enable_if_t<!__has_random_access_iterator_category<_ForwardIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
for (; __first != __last; ++__first)
@@ -36,12 +34,8 @@ __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
template <class _RandomAccessIterator,
class _Tp,
- __enable_if_t<(is_same<typename iterator_traits<_RandomAccessIterator>::iterator_category,
- random_access_iterator_tag>::value ||
- is_same<typename iterator_traits<_RandomAccessIterator>::iterator_category,
- contiguous_iterator_tag>::value) &&
- !__is_segmented_iterator<_RandomAccessIterator>::value,
- int> = 0>
+ __enable_if_t<__has_random_access_iterator_category<_RandomAccessIterator>::value &&
+ !__is_segmented_iterator<_RandomAccessIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value) {
std::fill_n(__first, __last - __first, __value);
>From 619d13bc495d20066612a9746ad244f8ccc54569 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 18 Aug 2024 01:42:46 +0500
Subject: [PATCH 04/24] Used std::for_each to remove redundant code
---
libcxx/include/__algorithm/fill.h | 49 ++++++++++++++++---------------
1 file changed, 26 insertions(+), 23 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index b8d893e2ee7339..32439f03dc9cff 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -10,6 +10,7 @@
#define _LIBCPP___ALGORITHM_FILL_H
#include <__algorithm/fill_n.h>
+#include <__algorithm/for_each.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__iterator/segmented_iterator.h>
@@ -22,10 +23,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
-template <
- class _ForwardIterator,
- class _Tp,
- __enable_if_t<!__has_random_access_iterator_category<_ForwardIterator>::value, int> = 0>
+template < class _ForwardIterator,
+ class _Tp,
+ __enable_if_t<!__has_random_access_iterator_category<_ForwardIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
for (; __first != __last; ++__first)
@@ -35,7 +35,8 @@ __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
template <class _RandomAccessIterator,
class _Tp,
__enable_if_t<__has_random_access_iterator_category<_RandomAccessIterator>::value &&
- !__is_segmented_iterator<_RandomAccessIterator>::value, int> = 0>
+ !__is_segmented_iterator<_RandomAccessIterator>::value,
+ int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value) {
std::fill_n(__first, __last - __first, __value);
@@ -46,27 +47,29 @@ template <class _SegmentedIterator,
__enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
- using _Traits = __segmented_iterator_traits<_SegmentedIterator>;
+ // using _Traits = __segmented_iterator_traits<_SegmentedIterator>;
- auto __sfirst = _Traits::__segment(__first);
- auto __slast = _Traits::__segment(__last);
+ // auto __sfirst = _Traits::__segment(__first);
+ // auto __slast = _Traits::__segment(__last);
- // We are in a single segment, so we might not be at the beginning or end
- if (__sfirst == __slast) {
- __fill(_Traits::__local(__first), _Traits::__local(__last), __value);
- return;
- }
+ // // We are in a single segment, so we might not be at the beginning or end
+ // if (__sfirst == __slast) {
+ // __fill(_Traits::__local(__first), _Traits::__local(__last), __value);
+ // return;
+ // }
- // We have more than one segment. Iterate over the first segment, since we might not start at the beginning
- __fill(_Traits::__local(__first), _Traits::__end(__sfirst), __value);
- ++__sfirst;
- // iterate over the segments which are guaranteed to be completely in the range
- while (__sfirst != __slast) {
- __fill(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), __value);
- ++__sfirst;
- }
- // iterate over the last segment
- __fill(_Traits::__begin(__sfirst), _Traits::__local(__last), __value);
+ // // We have more than one segment. Iterate over the first segment, since we might not start at the beginning
+ // __fill(_Traits::__local(__first), _Traits::__end(__sfirst), __value);
+ // ++__sfirst;
+ // // iterate over the segments which are guaranteed to be completely in the range
+ // while (__sfirst != __slast) {
+ // __fill(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), __value);
+ // ++__sfirst;
+ // }
+ // // iterate over the last segment
+ // __fill(_Traits::__begin(__sfirst), _Traits::__local(__last), __value);
+
+ std::for_each(__first, __last, [__value](_Tp& val) { val = __value; });
}
template <class _ForwardIterator, class _Tp>
>From 2ea7851d71a757f95317d8524456f97d477dd49c Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 18 Aug 2024 01:53:47 +0500
Subject: [PATCH 05/24] Fixed case
---
libcxx/include/__algorithm/fill.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 32439f03dc9cff..df9eb6ed16aa23 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -69,7 +69,7 @@ __fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value
// // iterate over the last segment
// __fill(_Traits::__begin(__sfirst), _Traits::__local(__last), __value);
- std::for_each(__first, __last, [__value](_Tp& val) { val = __value; });
+ std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
}
template <class _ForwardIterator, class _Tp>
>From 31d1fac90627d199b994965569f5e25bb5eb2725 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Thu, 22 Aug 2024 16:26:51 +0500
Subject: [PATCH 06/24] Added benchmark
---
libcxx/include/__algorithm/fill.h | 22 -------------------
.../test/benchmarks/algorithms/fill.bench.cpp | 10 +++++++++
2 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index df9eb6ed16aa23..41f37c46fe471d 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -47,28 +47,6 @@ template <class _SegmentedIterator,
__enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
- // using _Traits = __segmented_iterator_traits<_SegmentedIterator>;
-
- // auto __sfirst = _Traits::__segment(__first);
- // auto __slast = _Traits::__segment(__last);
-
- // // We are in a single segment, so we might not be at the beginning or end
- // if (__sfirst == __slast) {
- // __fill(_Traits::__local(__first), _Traits::__local(__last), __value);
- // return;
- // }
-
- // // We have more than one segment. Iterate over the first segment, since we might not start at the beginning
- // __fill(_Traits::__local(__first), _Traits::__end(__sfirst), __value);
- // ++__sfirst;
- // // iterate over the segments which are guaranteed to be completely in the range
- // while (__sfirst != __slast) {
- // __fill(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), __value);
- // ++__sfirst;
- // }
- // // iterate over the last segment
- // __fill(_Traits::__begin(__sfirst), _Traits::__local(__last), __value);
-
std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
}
diff --git a/libcxx/test/benchmarks/algorithms/fill.bench.cpp b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
index 40f37425c394cf..313fc7f849cbe5 100644
--- a/libcxx/test/benchmarks/algorithms/fill.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include <benchmark/benchmark.h>
#include <vector>
+#include <deque>
static void bm_fill_n(benchmark::State& state) {
std::vector<bool> vec1(state.range());
@@ -37,6 +38,15 @@ static void bm_fill(benchmark::State& state) {
}
BENCHMARK(bm_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
+static void bm_deque_fill(benchmark::State& state) {
+ std::deque<bool> vec1(state.range());
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(vec1);
+ std::fill(vec1.begin(), vec1.end(), false);
+ }
+}
+BENCHMARK(bm_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
+
static void bm_ranges_fill(benchmark::State& state) {
std::vector<bool> vec1(state.range());
for (auto _ : state) {
>From c540e31b0b76bdb323385258f5b73f4334d43b62 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sat, 24 Aug 2024 12:00:13 +0500
Subject: [PATCH 07/24] Added call to benchmark
---
libcxx/include/__algorithm/fill.h | 1 +
libcxx/test/benchmarks/algorithms/fill.bench.cpp | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 41f37c46fe471d..954814ff4c00d1 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -59,3 +59,4 @@ fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___ALGORITHM_FILL_H
+
diff --git a/libcxx/test/benchmarks/algorithms/fill.bench.cpp b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
index 313fc7f849cbe5..ccfb866c147b12 100644
--- a/libcxx/test/benchmarks/algorithms/fill.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
@@ -45,7 +45,7 @@ static void bm_deque_fill(benchmark::State& state) {
std::fill(vec1.begin(), vec1.end(), false);
}
}
-BENCHMARK(bm_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
+BENCHMARK(bm_deque_fill)->DenseRange(1, 8)->Range(16, 1 << 20);
static void bm_ranges_fill(benchmark::State& state) {
std::vector<bool> vec1(state.range());
>From faa8e2eb769d762304dae6095613cbfcf612553d Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sat, 24 Aug 2024 12:24:48 +0500
Subject: [PATCH 08/24] Added release note
---
libcxx/docs/ReleaseNotes/20.rst | 3 +++
libcxx/include/__algorithm/fill.h | 1 -
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/libcxx/docs/ReleaseNotes/20.rst b/libcxx/docs/ReleaseNotes/20.rst
index 82c8286b69e23c..c434c4f4480e8a 100644
--- a/libcxx/docs/ReleaseNotes/20.rst
+++ b/libcxx/docs/ReleaseNotes/20.rst
@@ -48,6 +48,9 @@ Improvements and New Features
- The ``lexicographical_compare`` and ``ranges::lexicographical_compare`` algorithms have been optimized for trivially
equality comparable types, resulting in a performance improvement of up to 40x.
+
+- ``std::fill`` has been optimized for segmented iterators like ``std::deque::iterator`` in C++23 and
+ later, which can lead up to 40x performance improvements.
- The ``_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER`` macro has been added to make ``std::get_temporary_buffer`` and
``std::return_temporary_buffer`` available.
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 954814ff4c00d1..41f37c46fe471d 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -59,4 +59,3 @@ fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___ALGORITHM_FILL_H
-
>From bdbfdbd36de2d187ca6026541d7379115a037537 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Mon, 26 Aug 2024 09:57:13 +0500
Subject: [PATCH 09/24] Added tests
---
.../alg.modifying.operations/alg.fill/fill.pass.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
index 481d565961b2b5..86cc7d46d15f65 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
@@ -17,6 +17,7 @@
#include <array>
#include <cassert>
#include <vector>
+#include <deque>
#include "test_macros.h"
#include "test_iterators.h"
@@ -101,5 +102,14 @@ int main(int, char**) {
static_assert(test());
#endif
+ // check that segmented iterators work properly
+ int sizes[] = {0, 1, 2, 1023, 1024, 1025, 2047, 2048, 2049};
+ for (const int size : sizes) {
+ std::deque<bool> in(size, false);
+ std::deque<bool> expected(size, true);
+ std::fill(in.begin(), in.end(), true);
+ assert(in == expected);
+ }
+
return 0;
}
>From 9799e461c71a7eba56925d8f6353fbf094c9c0fe Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Mon, 26 Aug 2024 16:38:29 +0500
Subject: [PATCH 10/24] Added functor
---
libcxx/include/__algorithm/fill.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 41f37c46fe471d..7518bb4fcd6336 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -42,12 +42,21 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _
std::fill_n(__first, __last - __first, __value);
}
+template <class _Tp>
+struct __fill_segment {
+ const _Tp& __value_;
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __fill_segment(const _Tp& __value) : __value_(__value) {}
+
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void operator()(_Tp& __val) const { __val = __value_; }
+};
+
template <class _SegmentedIterator,
class _Tp,
__enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
- std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
+ std::for_each(__first, __last, __fill_segment<_Tp>(__value));
}
template <class _ForwardIterator, class _Tp>
>From 121e61f1a234dd57dc3394f12b2f2cdf30f4df8a Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Mon, 26 Aug 2024 18:04:35 +0500
Subject: [PATCH 11/24] Fixed
---
libcxx/include/__algorithm/fill.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 7518bb4fcd6336..e523d4c79e78b7 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -48,7 +48,7 @@ struct __fill_segment {
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __fill_segment(const _Tp& __value) : __value_(__value) {}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void operator()(_Tp& __val) const { __val = __value_; }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()(_Tp& __val) const { __val = __value_; }
};
template <class _SegmentedIterator,
>From 57d17148e142d20d987f14bc694aac941ae74909 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Wed, 28 Aug 2024 18:44:31 +0500
Subject: [PATCH 12/24] Optimized fill_n
---
libcxx/include/__algorithm/fill.h | 15 ++++----------
libcxx/include/__algorithm/fill_n.h | 20 +++++++++++++++++--
.../test/benchmarks/algorithms/fill.bench.cpp | 9 +++++++++
.../alg.fill/fill_n.pass.cpp | 13 ++++++++++++
4 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index e523d4c79e78b7..d99c7f57611a83 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -9,7 +9,6 @@
#ifndef _LIBCPP___ALGORITHM_FILL_H
#define _LIBCPP___ALGORITHM_FILL_H
-#include <__algorithm/fill_n.h>
#include <__algorithm/for_each.h>
#include <__config>
#include <__iterator/iterator_traits.h>
@@ -22,6 +21,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
+template <class _OutputIterator, class _Size, class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
template < class _ForwardIterator,
class _Tp,
@@ -42,21 +44,12 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _
std::fill_n(__first, __last - __first, __value);
}
-template <class _Tp>
-struct __fill_segment {
- const _Tp& __value_;
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __fill_segment(const _Tp& __value) : __value_(__value) {}
-
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()(_Tp& __val) const { __val = __value_; }
-};
-
template <class _SegmentedIterator,
class _Tp,
__enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
- std::for_each(__first, __last, __fill_segment<_Tp>(__value));
+ std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
}
template <class _ForwardIterator, class _Tp>
diff --git a/libcxx/include/__algorithm/fill_n.h b/libcxx/include/__algorithm/fill_n.h
index f29633f88087f0..817a5578786246 100644
--- a/libcxx/include/__algorithm/fill_n.h
+++ b/libcxx/include/__algorithm/fill_n.h
@@ -15,6 +15,8 @@
#include <__iterator/iterator_traits.h>
#include <__memory/pointer_traits.h>
#include <__utility/convert_to_integral.h>
+#include <__iterator/segmented_iterator.h>
+#include <__type_traits/enable_if.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -26,8 +28,15 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
// fill_n isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
+template <class _ForwardIterator, class _Tp>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
-template <class _OutputIterator, class _Size, class _Tp>
+template <class _OutputIterator, class _Size, class _Tp, enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
+
+template <class _OutputIterator, class _Size, class _Tp, enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
@@ -77,7 +86,7 @@ __fill_n(__bit_iterator<_Cp, false> __first, _Size __n, const bool& __value) {
return __first + __n;
}
-template <class _OutputIterator, class _Size, class _Tp>
+template <class _OutputIterator, class _Size, class _Tp, enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int>>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
for (; __n > 0; ++__first, (void)--__n)
@@ -85,6 +94,13 @@ __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
return __first;
}
+template <class _OutputIterator, class _Size, class _Tp, enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int>>
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
+__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
+ std::fill(__first, __first + __n, __value);
+ return __n > 0 ? __first + __n : __first;
+}
+
template <class _OutputIterator, class _Size, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
diff --git a/libcxx/test/benchmarks/algorithms/fill.bench.cpp b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
index ccfb866c147b12..6b65755e3ce9cd 100644
--- a/libcxx/test/benchmarks/algorithms/fill.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
@@ -20,6 +20,15 @@ static void bm_fill_n(benchmark::State& state) {
}
BENCHMARK(bm_fill_n)->DenseRange(1, 8)->Range(16, 1 << 20);
+static void bm_deque_fill_n(benchmark::State& state) {
+ std::deque<bool> vec1(state.range());
+ for (auto _ : state) {
+ benchmark::DoNotOptimize(vec1);
+ benchmark::DoNotOptimize(std::fill_n(vec1.begin(), vec1.size(), false));
+ }
+}
+BENCHMARK(bm_deque_fill_n)->DenseRange(1, 8)->Range(16, 1 << 20);
+
static void bm_ranges_fill_n(benchmark::State& state) {
std::vector<bool> vec1(state.range());
for (auto _ : state) {
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index 7d6770de702bf3..ef4a666834b2e4 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -15,6 +15,7 @@
#include <algorithm>
#include <cassert>
+#include <deque>
#include "test_macros.h"
#include "test_iterators.h"
@@ -144,6 +145,16 @@ void test6()
std::fill_n(&foo[0], UDI(5), Storage());
}
+void test_deque() {
+ std::deque<int> dq(5);
+ std::fill_n(dq.begin(), dq.size(), 4);
+ assert(dq[0] == 4);
+ assert(dq[1] == 4);
+ assert(dq[2] == 4);
+ assert(dq[3] == 4);
+ assert(dq[4] == 4);
+}
+
int main(int, char**)
{
@@ -166,6 +177,8 @@ int main(int, char**)
test5();
test6();
+ test_deque();
+
#if TEST_STD_VER > 17
static_assert(test_constexpr());
#endif
>From b7f93520af65110dd93cdb5cf1af0a832dba9bd6 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Wed, 28 Aug 2024 19:05:08 +0500
Subject: [PATCH 13/24] Formatted
---
libcxx/include/__algorithm/fill_n.h | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/libcxx/include/__algorithm/fill_n.h b/libcxx/include/__algorithm/fill_n.h
index 817a5578786246..efa549481c98fb 100644
--- a/libcxx/include/__algorithm/fill_n.h
+++ b/libcxx/include/__algorithm/fill_n.h
@@ -13,10 +13,10 @@
#include <__config>
#include <__fwd/bit_reference.h>
#include <__iterator/iterator_traits.h>
-#include <__memory/pointer_traits.h>
-#include <__utility/convert_to_integral.h>
#include <__iterator/segmented_iterator.h>
+#include <__memory/pointer_traits.h>
#include <__type_traits/enable_if.h>
+#include <__utility/convert_to_integral.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -32,11 +32,17 @@ template <class _ForwardIterator, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
-template <class _OutputIterator, class _Size, class _Tp, enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int> = 0>
+template <class _OutputIterator,
+ class _Size,
+ class _Tp,
+ enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
-template <class _OutputIterator, class _Size, class _Tp, enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int> = 0>
+template <class _OutputIterator,
+ class _Size,
+ class _Tp,
+ enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
@@ -86,7 +92,10 @@ __fill_n(__bit_iterator<_Cp, false> __first, _Size __n, const bool& __value) {
return __first + __n;
}
-template <class _OutputIterator, class _Size, class _Tp, enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int>>
+template <class _OutputIterator,
+ class _Size,
+ class _Tp,
+ enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int>>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
for (; __n > 0; ++__first, (void)--__n)
@@ -94,7 +103,10 @@ __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
return __first;
}
-template <class _OutputIterator, class _Size, class _Tp, enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int>>
+template <class _OutputIterator,
+ class _Size,
+ class _Tp,
+ enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int>>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
std::fill(__first, __first + __n, __value);
>From 5d8ccc382bbe7ae599aec419107795941b975932 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Wed, 28 Aug 2024 19:13:23 +0500
Subject: [PATCH 14/24] Formatted
---
.../alg.fill/fill_n.pass.cpp | 215 ++++++++----------
1 file changed, 98 insertions(+), 117 deletions(-)
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index ef4a666834b2e4..89c7b854586711 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -23,164 +23,145 @@
#if TEST_STD_VER > 17
TEST_CONSTEXPR bool test_constexpr() {
- const std::size_t N = 5;
- int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
-
- auto it = std::fill_n(std::begin(ib), N, 5);
- return it == (std::begin(ib) + N)
- && std::all_of(std::begin(ib), it, [](int a) {return a == 5; })
- && *it == 0 // don't overwrite the last value in the output array
- ;
- }
+ const std::size_t N = 5;
+ int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
+
+ auto it = std::fill_n(std::begin(ib), N, 5);
+ return it == (std::begin(ib) + N) && std::all_of(std::begin(ib), it, [](int a) { return a == 5; }) &&
+ *it == 0 // don't overwrite the last value in the output array
+ ;
+}
#endif
typedef UserDefinedIntegral<unsigned> UDI;
template <class Iter>
-void
-test_char()
-{
- char a[4] = {};
- Iter it = std::fill_n(Iter(a), UDI(4), char(1));
- assert(base(it) == a + 4);
- assert(a[0] == 1);
- assert(a[1] == 1);
- assert(a[2] == 1);
- assert(a[3] == 1);
+void test_char() {
+ char a[4] = {};
+ Iter it = std::fill_n(Iter(a), UDI(4), char(1));
+ assert(base(it) == a + 4);
+ assert(a[0] == 1);
+ assert(a[1] == 1);
+ assert(a[2] == 1);
+ assert(a[3] == 1);
}
template <class Iter>
-void
-test_int()
-{
- int a[4] = {};
- Iter it = std::fill_n(Iter(a), UDI(4), 1);
- assert(base(it) == a + 4);
- assert(a[0] == 1);
- assert(a[1] == 1);
- assert(a[2] == 1);
- assert(a[3] == 1);
+void test_int() {
+ int a[4] = {};
+ Iter it = std::fill_n(Iter(a), UDI(4), 1);
+ assert(base(it) == a + 4);
+ assert(a[0] == 1);
+ assert(a[1] == 1);
+ assert(a[2] == 1);
+ assert(a[3] == 1);
}
-void
-test_int_array()
-{
- int a[4] = {};
- assert(std::fill_n(a, UDI(4), static_cast<char>(1)) == a + 4);
- assert(a[0] == 1);
- assert(a[1] == 1);
- assert(a[2] == 1);
- assert(a[3] == 1);
+void test_int_array() {
+ int a[4] = {};
+ assert(std::fill_n(a, UDI(4), static_cast<char>(1)) == a + 4);
+ assert(a[0] == 1);
+ assert(a[1] == 1);
+ assert(a[2] == 1);
+ assert(a[3] == 1);
}
struct source {
- source() : i(0) { }
+ source() : i(0) {}
- operator int() const { return i++; }
- mutable int i;
+ operator int() const { return i++; }
+ mutable int i;
};
-void
-test_int_array_struct_source()
-{
- int a[4] = {};
- assert(std::fill_n(a, UDI(4), source()) == a + 4);
- assert(a[0] == 0);
- assert(a[1] == 1);
- assert(a[2] == 2);
- assert(a[3] == 3);
+void test_int_array_struct_source() {
+ int a[4] = {};
+ assert(std::fill_n(a, UDI(4), source()) == a + 4);
+ assert(a[0] == 0);
+ assert(a[1] == 1);
+ assert(a[2] == 2);
+ assert(a[3] == 3);
}
struct test1 {
- test1() : c(0) { }
- test1(char xc) : c(xc + 1) { }
- char c;
+ test1() : c(0) {}
+ test1(char xc) : c(xc + 1) {}
+ char c;
};
-void
-test_struct_array()
-{
- test1 test1a[4] = {};
- assert(std::fill_n(test1a, UDI(4), static_cast<char>(10)) == test1a + 4);
- assert(test1a[0].c == 11);
- assert(test1a[1].c == 11);
- assert(test1a[2].c == 11);
- assert(test1a[3].c == 11);
+void test_struct_array() {
+ test1 test1a[4] = {};
+ assert(std::fill_n(test1a, UDI(4), static_cast<char>(10)) == test1a + 4);
+ assert(test1a[0].c == 11);
+ assert(test1a[1].c == 11);
+ assert(test1a[2].c == 11);
+ assert(test1a[3].c == 11);
}
-class A
-{
- char a_;
+class A {
+ char a_;
+
public:
- A() {}
- explicit A(char a) : a_(a) {}
- operator unsigned char() const {return 'b';}
+ A() {}
+ explicit A(char a) : a_(a) {}
+ operator unsigned char() const { return 'b'; }
- friend bool operator==(const A& x, const A& y)
- {return x.a_ == y.a_;}
+ friend bool operator==(const A& x, const A& y) { return x.a_ == y.a_; }
};
-void
-test5()
-{
- A a[3];
- assert(std::fill_n(&a[0], UDI(3), A('a')) == a+3);
- assert(a[0] == A('a'));
- assert(a[1] == A('a'));
- assert(a[2] == A('a'));
+void test5() {
+ A a[3];
+ assert(std::fill_n(&a[0], UDI(3), A('a')) == a + 3);
+ assert(a[0] == A('a'));
+ assert(a[1] == A('a'));
+ assert(a[2] == A('a'));
}
-struct Storage
-{
- union
- {
+struct Storage {
+ union {
unsigned char a;
unsigned char b;
};
};
-void test6()
-{
+void test6() {
Storage foo[5];
std::fill_n(&foo[0], UDI(5), Storage());
}
void test_deque() {
- std::deque<int> dq(5);
- std::fill_n(dq.begin(), dq.size(), 4);
- assert(dq[0] == 4);
- assert(dq[1] == 4);
- assert(dq[2] == 4);
- assert(dq[3] == 4);
- assert(dq[4] == 4);
-}
-
-
-int main(int, char**)
-{
- test_char<cpp17_output_iterator<char*> >();
- test_char<forward_iterator<char*> >();
- test_char<bidirectional_iterator<char*> >();
- test_char<random_access_iterator<char*> >();
- test_char<char*>();
-
- test_int<cpp17_output_iterator<int*> >();
- test_int<forward_iterator<int*> >();
- test_int<bidirectional_iterator<int*> >();
- test_int<random_access_iterator<int*> >();
- test_int<int*>();
-
- test_int_array();
- test_int_array_struct_source();
- test_struct_array();
-
- test5();
- test6();
-
- test_deque();
+ std::deque<int> dq(5);
+ std::fill_n(dq.begin(), dq.size(), 4);
+ assert(dq[0] == 4);
+ assert(dq[1] == 4);
+ assert(dq[2] == 4);
+ assert(dq[3] == 4);
+ assert(dq[4] == 4);
+}
+
+int main(int, char**) {
+ test_char<cpp17_output_iterator<char*> >();
+ test_char<forward_iterator<char*> >();
+ test_char<bidirectional_iterator<char*> >();
+ test_char<random_access_iterator<char*> >();
+ test_char<char*>();
+
+ test_int<cpp17_output_iterator<int*> >();
+ test_int<forward_iterator<int*> >();
+ test_int<bidirectional_iterator<int*> >();
+ test_int<random_access_iterator<int*> >();
+ test_int<int*>();
+
+ test_int_array();
+ test_int_array_struct_source();
+ test_struct_array();
+
+ test5();
+ test6();
+
+ test_deque();
#if TEST_STD_VER > 17
- static_assert(test_constexpr());
+ static_assert(test_constexpr());
#endif
return 0;
>From cde55e5526da12d39a5797395656e1e8be3abf6e Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Wed, 28 Aug 2024 19:19:11 +0500
Subject: [PATCH 15/24] Fixed
---
libcxx/include/__algorithm/fill_n.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libcxx/include/__algorithm/fill_n.h b/libcxx/include/__algorithm/fill_n.h
index efa549481c98fb..f18569748469b0 100644
--- a/libcxx/include/__algorithm/fill_n.h
+++ b/libcxx/include/__algorithm/fill_n.h
@@ -35,14 +35,14 @@ fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
template <class _OutputIterator,
class _Size,
class _Tp,
- enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int> = 0>
+ __enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
template <class _OutputIterator,
class _Size,
class _Tp,
- enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int> = 0>
+ __enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
@@ -95,7 +95,7 @@ __fill_n(__bit_iterator<_Cp, false> __first, _Size __n, const bool& __value) {
template <class _OutputIterator,
class _Size,
class _Tp,
- enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int>>
+ __enable_if_t<!__is_segmented_iterator<_OutputIterator>::value, int> >
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
for (; __n > 0; ++__first, (void)--__n)
@@ -106,7 +106,7 @@ __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
template <class _OutputIterator,
class _Size,
class _Tp,
- enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int>>
+ __enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int> >
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
std::fill(__first, __first + __n, __value);
>From f237da3bbb62604a81d1e46247ada2cfde974ee8 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Mon, 2 Sep 2024 09:33:46 +0500
Subject: [PATCH 16/24] Rebased and release note added for fill_n
---
libcxx/docs/ReleaseNotes/20.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libcxx/docs/ReleaseNotes/20.rst b/libcxx/docs/ReleaseNotes/20.rst
index c434c4f4480e8a..1e0882894437ff 100644
--- a/libcxx/docs/ReleaseNotes/20.rst
+++ b/libcxx/docs/ReleaseNotes/20.rst
@@ -51,6 +51,9 @@ Improvements and New Features
- ``std::fill`` has been optimized for segmented iterators like ``std::deque::iterator`` in C++23 and
later, which can lead up to 40x performance improvements.
+
+- ``std::fill_n`` has been optimized for segmented iterators like ``std::deque::iterator`` in C++23 and
+ later, which can lead up to 40x performance improvements.
- The ``_LIBCPP_ENABLE_CXX20_REMOVED_TEMPORARY_BUFFER`` macro has been added to make ``std::get_temporary_buffer`` and
``std::return_temporary_buffer`` available.
>From c4d9a6b1676be61b44d869cdc77a81cb52943c1a Mon Sep 17 00:00:00 2001
From: NoumanAmir-10xe <66777536+NoumanAmir657 at users.noreply.github.com>
Date: Sun, 8 Sep 2024 20:19:54 +0500
Subject: [PATCH 17/24] Delete
libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
---
.../alg.fill/fill_n.pass.cpp | 168 ------------------
1 file changed, 168 deletions(-)
delete mode 100644 libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
deleted file mode 100644
index 89c7b854586711..00000000000000
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <algorithm>
-
-// template<class Iter, IntegralLike Size, class T>
-// requires OutputIterator<Iter, const T&>
-// constexpr OutputIterator // constexpr after C++17
-// fill_n(Iter first, Size n, const T& value);
-
-#include <algorithm>
-#include <cassert>
-#include <deque>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-#include "user_defined_integral.h"
-
-#if TEST_STD_VER > 17
-TEST_CONSTEXPR bool test_constexpr() {
- const std::size_t N = 5;
- int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
-
- auto it = std::fill_n(std::begin(ib), N, 5);
- return it == (std::begin(ib) + N) && std::all_of(std::begin(ib), it, [](int a) { return a == 5; }) &&
- *it == 0 // don't overwrite the last value in the output array
- ;
-}
-#endif
-
-typedef UserDefinedIntegral<unsigned> UDI;
-
-template <class Iter>
-void test_char() {
- char a[4] = {};
- Iter it = std::fill_n(Iter(a), UDI(4), char(1));
- assert(base(it) == a + 4);
- assert(a[0] == 1);
- assert(a[1] == 1);
- assert(a[2] == 1);
- assert(a[3] == 1);
-}
-
-template <class Iter>
-void test_int() {
- int a[4] = {};
- Iter it = std::fill_n(Iter(a), UDI(4), 1);
- assert(base(it) == a + 4);
- assert(a[0] == 1);
- assert(a[1] == 1);
- assert(a[2] == 1);
- assert(a[3] == 1);
-}
-
-void test_int_array() {
- int a[4] = {};
- assert(std::fill_n(a, UDI(4), static_cast<char>(1)) == a + 4);
- assert(a[0] == 1);
- assert(a[1] == 1);
- assert(a[2] == 1);
- assert(a[3] == 1);
-}
-
-struct source {
- source() : i(0) {}
-
- operator int() const { return i++; }
- mutable int i;
-};
-
-void test_int_array_struct_source() {
- int a[4] = {};
- assert(std::fill_n(a, UDI(4), source()) == a + 4);
- assert(a[0] == 0);
- assert(a[1] == 1);
- assert(a[2] == 2);
- assert(a[3] == 3);
-}
-
-struct test1 {
- test1() : c(0) {}
- test1(char xc) : c(xc + 1) {}
- char c;
-};
-
-void test_struct_array() {
- test1 test1a[4] = {};
- assert(std::fill_n(test1a, UDI(4), static_cast<char>(10)) == test1a + 4);
- assert(test1a[0].c == 11);
- assert(test1a[1].c == 11);
- assert(test1a[2].c == 11);
- assert(test1a[3].c == 11);
-}
-
-class A {
- char a_;
-
-public:
- A() {}
- explicit A(char a) : a_(a) {}
- operator unsigned char() const { return 'b'; }
-
- friend bool operator==(const A& x, const A& y) { return x.a_ == y.a_; }
-};
-
-void test5() {
- A a[3];
- assert(std::fill_n(&a[0], UDI(3), A('a')) == a + 3);
- assert(a[0] == A('a'));
- assert(a[1] == A('a'));
- assert(a[2] == A('a'));
-}
-
-struct Storage {
- union {
- unsigned char a;
- unsigned char b;
- };
-};
-
-void test6() {
- Storage foo[5];
- std::fill_n(&foo[0], UDI(5), Storage());
-}
-
-void test_deque() {
- std::deque<int> dq(5);
- std::fill_n(dq.begin(), dq.size(), 4);
- assert(dq[0] == 4);
- assert(dq[1] == 4);
- assert(dq[2] == 4);
- assert(dq[3] == 4);
- assert(dq[4] == 4);
-}
-
-int main(int, char**) {
- test_char<cpp17_output_iterator<char*> >();
- test_char<forward_iterator<char*> >();
- test_char<bidirectional_iterator<char*> >();
- test_char<random_access_iterator<char*> >();
- test_char<char*>();
-
- test_int<cpp17_output_iterator<int*> >();
- test_int<forward_iterator<int*> >();
- test_int<bidirectional_iterator<int*> >();
- test_int<random_access_iterator<int*> >();
- test_int<int*>();
-
- test_int_array();
- test_int_array_struct_source();
- test_struct_array();
-
- test5();
- test6();
-
- test_deque();
-
-#if TEST_STD_VER > 17
- static_assert(test_constexpr());
-#endif
-
- return 0;
-}
>From 5fc7a14959a237311864f38536072428ccda2825 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 8 Sep 2024 20:39:31 +0500
Subject: [PATCH 18/24] Remove conditonal check
---
libcxx/include/__algorithm/fill.h | 3 +-
.../alg.fill/fill_n.pass.cpp | 174 ++++++++++++++++++
2 files changed, 175 insertions(+), 2 deletions(-)
create mode 100644 libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index d99c7f57611a83..d0592237359f81 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -45,8 +45,7 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _
}
template <class _SegmentedIterator,
- class _Tp,
- __enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
+ class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
new file mode 100644
index 00000000000000..c682e3335a58fc
--- /dev/null
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -0,0 +1,174 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<class Iter, IntegralLike Size, class T>
+// requires OutputIterator<Iter, const T&>
+// constexpr OutputIterator // constexpr after C++17
+// fill_n(Iter first, Size n, const T& value);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "user_defined_integral.h"
+
+#if TEST_STD_VER > 17
+TEST_CONSTEXPR bool test_constexpr() {
+ const std::size_t N = 5;
+ int ib[] = {0, 0, 0, 0, 0, 0}; // one bigger than N
+
+ auto it = std::fill_n(std::begin(ib), N, 5);
+ return it == (std::begin(ib) + N)
+ && std::all_of(std::begin(ib), it, [](int a) {return a == 5; })
+ && *it == 0 // don't overwrite the last value in the output array
+ ;
+ }
+#endif
+
+typedef UserDefinedIntegral<unsigned> UDI;
+
+template <class Iter>
+void
+test_char()
+{
+ char a[4] = {};
+ Iter it = std::fill_n(Iter(a), UDI(4), char(1));
+ assert(base(it) == a + 4);
+ assert(a[0] == 1);
+ assert(a[1] == 1);
+ assert(a[2] == 1);
+ assert(a[3] == 1);
+}
+
+template <class Iter>
+void
+test_int()
+{
+ int a[4] = {};
+ Iter it = std::fill_n(Iter(a), UDI(4), 1);
+ assert(base(it) == a + 4);
+ assert(a[0] == 1);
+ assert(a[1] == 1);
+ assert(a[2] == 1);
+ assert(a[3] == 1);
+}
+
+void
+test_int_array()
+{
+ int a[4] = {};
+ assert(std::fill_n(a, UDI(4), static_cast<char>(1)) == a + 4);
+ assert(a[0] == 1);
+ assert(a[1] == 1);
+ assert(a[2] == 1);
+ assert(a[3] == 1);
+}
+
+struct source {
+ source() : i(0) { }
+
+ operator int() const { return i++; }
+ mutable int i;
+};
+
+void
+test_int_array_struct_source()
+{
+ int a[4] = {};
+ assert(std::fill_n(a, UDI(4), source()) == a + 4);
+ assert(a[0] == 0);
+ assert(a[1] == 1);
+ assert(a[2] == 2);
+ assert(a[3] == 3);
+}
+
+struct test1 {
+ test1() : c(0) { }
+ test1(char xc) : c(xc + 1) { }
+ char c;
+};
+
+void
+test_struct_array()
+{
+ test1 test1a[4] = {};
+ assert(std::fill_n(test1a, UDI(4), static_cast<char>(10)) == test1a + 4);
+ assert(test1a[0].c == 11);
+ assert(test1a[1].c == 11);
+ assert(test1a[2].c == 11);
+ assert(test1a[3].c == 11);
+}
+
+class A
+{
+ char a_;
+public:
+ A() {}
+ explicit A(char a) : a_(a) {}
+ operator unsigned char() const {return 'b';}
+
+ friend bool operator==(const A& x, const A& y)
+ {return x.a_ == y.a_;}
+};
+
+void
+test5()
+{
+ A a[3];
+ assert(std::fill_n(&a[0], UDI(3), A('a')) == a+3);
+ assert(a[0] == A('a'));
+ assert(a[1] == A('a'));
+ assert(a[2] == A('a'));
+}
+
+struct Storage
+{
+ union
+ {
+ unsigned char a;
+ unsigned char b;
+ };
+};
+
+void test6()
+{
+ Storage foo[5];
+ std::fill_n(&foo[0], UDI(5), Storage());
+}
+
+
+int main(int, char**)
+{
+ test_char<cpp17_output_iterator<char*> >();
+ test_char<forward_iterator<char*> >();
+ test_char<bidirectional_iterator<char*> >();
+ test_char<random_access_iterator<char*> >();
+ test_char<char*>();
+
+ test_int<cpp17_output_iterator<int*> >();
+ test_int<forward_iterator<int*> >();
+ test_int<bidirectional_iterator<int*> >();
+ test_int<random_access_iterator<int*> >();
+ test_int<int*>();
+
+ test_int_array();
+ test_int_array_struct_source();
+ test_struct_array();
+
+ test5();
+ test6();
+
+#if TEST_STD_VER > 17
+ static_assert(test_constexpr());
+#endif
+
+ return 0;
+}
\ No newline at end of file
>From 4d3729151cc48fd3c08d0e964babfe43a0a251c7 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 8 Sep 2024 20:46:35 +0500
Subject: [PATCH 19/24] Format
---
libcxx/include/__algorithm/fill.h | 3 +--
.../alg.fill/fill_n.pass.cpp | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index d0592237359f81..0886bc889ca88b 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -44,8 +44,7 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _
std::fill_n(__first, __last - __first, __value);
}
-template <class _SegmentedIterator,
- class _Tp>
+template <class _SegmentedIterator, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index c682e3335a58fc..37524ccbed5011 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -15,6 +15,7 @@
#include <algorithm>
#include <cassert>
+#include <deque>
#include "test_macros.h"
#include "test_iterators.h"
@@ -144,6 +145,18 @@ void test6()
std::fill_n(&foo[0], UDI(5), Storage());
}
+void
+test_deque()
+{
+ std::deque<int> dq(5);
+ std::fill_n(dq.begin(), dq.size(), 4);
+ assert(dq[0] == 4);
+ assert(dq[1] == 4);
+ assert(dq[2] == 4);
+ assert(dq[3] == 4);
+ assert(dq[4] == 4);
+}
+
int main(int, char**)
{
@@ -171,4 +184,4 @@ int main(int, char**)
#endif
return 0;
-}
\ No newline at end of file
+}
>From 87e77c01a5122ff4aea045fe037ebf4fab8842f0 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 8 Sep 2024 20:52:52 +0500
Subject: [PATCH 20/24] Formatted
---
.../alg.fill/fill_n.pass.cpp | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index 37524ccbed5011..457a7909d6ad6a 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -145,16 +145,14 @@ void test6()
std::fill_n(&foo[0], UDI(5), Storage());
}
-void
-test_deque()
-{
- std::deque<int> dq(5);
- std::fill_n(dq.begin(), dq.size(), 4);
- assert(dq[0] == 4);
- assert(dq[1] == 4);
- assert(dq[2] == 4);
- assert(dq[3] == 4);
- assert(dq[4] == 4);
+void test_deque() {
+ std::deque<int> dq(5);
+ std::fill_n(dq.begin(), dq.size(), 4);
+ assert(dq[0] == 4);
+ assert(dq[1] == 4);
+ assert(dq[2] == 4);
+ assert(dq[3] == 4);
+ assert(dq[4] == 4);
}
>From 77f00b0c64bf491a4ac7c8322ca5383fe32763aa Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 8 Sep 2024 20:57:26 +0500
Subject: [PATCH 21/24] Formatted
---
.../algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index 457a7909d6ad6a..cb9155501a8a71 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -155,7 +155,6 @@ void test_deque() {
assert(dq[4] == 4);
}
-
int main(int, char**)
{
test_char<cpp17_output_iterator<char*> >();
>From a178a006f387a9b3d58d5cfa928e48088594a82a Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 6 Oct 2024 13:26:19 +0500
Subject: [PATCH 22/24] Fixed some things
---
libcxx/include/__algorithm/fill.h | 4 +-
.../test/libcxx/transitive_includes/cxx03.csv | 36 ++++--------
.../test/libcxx/transitive_includes/cxx11.csv | 36 ++++--------
.../test/libcxx/transitive_includes/cxx14.csv | 37 ++++--------
.../test/libcxx/transitive_includes/cxx17.csv | 35 ++++--------
.../test/libcxx/transitive_includes/cxx20.csv | 36 ++++--------
.../test/libcxx/transitive_includes/cxx23.csv | 56 +++++++++++-------
.../test/libcxx/transitive_includes/cxx26.csv | 57 ++++++++++++-------
8 files changed, 134 insertions(+), 163 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 0886bc889ca88b..d99c7f57611a83 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -44,7 +44,9 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _
std::fill_n(__first, __last - __first, __value);
}
-template <class _SegmentedIterator, class _Tp>
+template <class _SegmentedIterator,
+ class _Tp,
+ __enable_if_t<__is_segmented_iterator<_SegmentedIterator>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__fill(_SegmentedIterator __first, _SegmentedIterator __last, const _Tp& __value) {
std::for_each(__first, __last, [__value](_Tp& __val) { __val = __value; });
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index 506b5cd02c4495..fc1e6d3f4f89a6 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -115,6 +115,7 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
+atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -144,6 +145,7 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
+bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -301,7 +303,9 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
+cmath cstddef
cmath cstdint
+cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -346,6 +350,7 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
+compare initializer_list
compare limits
compare type_traits
compare version
@@ -448,6 +453,7 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
+coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -577,43 +583,19 @@ expected initializer_list
expected new
expected type_traits
expected version
-experimental/iterator algorithm
-experimental/iterator atomic
-experimental/iterator bit
-experimental/iterator bitset
-experimental/iterator cctype
-experimental/iterator cerrno
-experimental/iterator climits
-experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
-experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
-experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
-experimental/iterator ctime
-experimental/iterator cwchar
-experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
-experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
-experimental/iterator locale
-experimental/iterator memory
-experimental/iterator mutex
experimental/iterator new
-experimental/iterator optional
-experimental/iterator ratio
-experimental/iterator stdexcept
-experimental/iterator streambuf
-experimental/iterator string
-experimental/iterator string_view
-experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -804,7 +786,6 @@ fstream filesystem
fstream format
fstream functional
fstream initializer_list
-fstream iomanip
fstream ios
fstream iosfwd
fstream istream
@@ -1165,10 +1146,12 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
+latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
+limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1777,6 +1760,7 @@ ranges variant
ranges vector
ranges version
ratio climits
+ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1861,6 +1845,7 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
+semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2426,6 +2411,7 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
+type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index 506b5cd02c4495..fc1e6d3f4f89a6 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -115,6 +115,7 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
+atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -144,6 +145,7 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
+bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -301,7 +303,9 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
+cmath cstddef
cmath cstdint
+cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -346,6 +350,7 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
+compare initializer_list
compare limits
compare type_traits
compare version
@@ -448,6 +453,7 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
+coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -577,43 +583,19 @@ expected initializer_list
expected new
expected type_traits
expected version
-experimental/iterator algorithm
-experimental/iterator atomic
-experimental/iterator bit
-experimental/iterator bitset
-experimental/iterator cctype
-experimental/iterator cerrno
-experimental/iterator climits
-experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
-experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
-experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
-experimental/iterator ctime
-experimental/iterator cwchar
-experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
-experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
-experimental/iterator locale
-experimental/iterator memory
-experimental/iterator mutex
experimental/iterator new
-experimental/iterator optional
-experimental/iterator ratio
-experimental/iterator stdexcept
-experimental/iterator streambuf
-experimental/iterator string
-experimental/iterator string_view
-experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -804,7 +786,6 @@ fstream filesystem
fstream format
fstream functional
fstream initializer_list
-fstream iomanip
fstream ios
fstream iosfwd
fstream istream
@@ -1165,10 +1146,12 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
+latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
+limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1777,6 +1760,7 @@ ranges variant
ranges vector
ranges version
ratio climits
+ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1861,6 +1845,7 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
+semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2426,6 +2411,7 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
+type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index 828e1d62c6ec3e..fcdaa82dfa5299 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -118,6 +118,7 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
+atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -147,6 +148,7 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
+bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -307,7 +309,9 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
+cmath cstddef
cmath cstdint
+cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -353,6 +357,7 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
+compare initializer_list
compare limits
compare type_traits
compare version
@@ -457,6 +462,7 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
+coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -588,44 +594,19 @@ expected initializer_list
expected new
expected type_traits
expected version
-experimental/iterator algorithm
-experimental/iterator atomic
-experimental/iterator bit
-experimental/iterator bitset
-experimental/iterator cctype
-experimental/iterator cerrno
-experimental/iterator climits
-experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
-experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
-experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
-experimental/iterator ctime
-experimental/iterator cwchar
-experimental/iterator cwctype
experimental/iterator exception
-experimental/iterator execution
experimental/iterator initializer_list
-experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
-experimental/iterator locale
-experimental/iterator memory
-experimental/iterator mutex
experimental/iterator new
-experimental/iterator optional
-experimental/iterator ratio
-experimental/iterator stdexcept
-experimental/iterator streambuf
-experimental/iterator string
-experimental/iterator string_view
-experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -825,7 +806,6 @@ fstream filesystem
fstream format
fstream functional
fstream initializer_list
-fstream iomanip
fstream ios
fstream iosfwd
fstream istream
@@ -1192,10 +1172,12 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
+latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
+limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1814,6 +1796,7 @@ ranges variant
ranges vector
ranges version
ratio climits
+ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1899,6 +1882,7 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
+semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2476,6 +2460,7 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
+type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 0bee6e9beb7af1..79563407442d6a 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -115,6 +115,7 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
+atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -144,6 +145,7 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
+bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -301,7 +303,9 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
+cmath cstddef
cmath cstdint
+cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -346,6 +350,7 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
+compare initializer_list
compare limits
compare type_traits
compare version
@@ -448,6 +453,7 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
+coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -577,43 +583,19 @@ expected initializer_list
expected new
expected type_traits
expected version
-experimental/iterator algorithm
-experimental/iterator atomic
-experimental/iterator bit
-experimental/iterator bitset
-experimental/iterator cctype
-experimental/iterator cerrno
-experimental/iterator climits
-experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
-experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
-experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
-experimental/iterator ctime
-experimental/iterator cwchar
-experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
-experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
-experimental/iterator locale
-experimental/iterator memory
-experimental/iterator mutex
experimental/iterator new
-experimental/iterator optional
-experimental/iterator ratio
-experimental/iterator stdexcept
-experimental/iterator streambuf
-experimental/iterator string
-experimental/iterator string_view
-experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -1189,10 +1171,12 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
+latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
+limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1801,6 +1785,7 @@ ranges variant
ranges vector
ranges version
ratio climits
+ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1885,6 +1870,7 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
+semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2450,6 +2436,7 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
+type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 026c26f3bd9819..0c16810f437b4c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -92,6 +92,7 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
+atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -121,6 +122,7 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
+bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -288,7 +290,9 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
+cmath cstddef
cmath cstdint
+cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -333,6 +337,7 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
+compare initializer_list
compare limits
compare type_traits
compare version
@@ -436,6 +441,7 @@ coroutine compare
coroutine cstddef
coroutine cstdint
coroutine cstring
+coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -565,43 +571,19 @@ expected initializer_list
expected new
expected type_traits
expected version
-experimental/iterator algorithm
-experimental/iterator atomic
-experimental/iterator bit
-experimental/iterator bitset
-experimental/iterator cctype
-experimental/iterator cerrno
-experimental/iterator climits
-experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
-experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
-experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
-experimental/iterator ctime
-experimental/iterator cwchar
-experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
-experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
-experimental/iterator locale
-experimental/iterator memory
-experimental/iterator mutex
experimental/iterator new
-experimental/iterator optional
-experimental/iterator ratio
-experimental/iterator stdexcept
-experimental/iterator streambuf
-experimental/iterator string
-experimental/iterator string_view
-experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -1175,10 +1157,12 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
+latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
+limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1787,6 +1771,7 @@ ranges variant
ranges vector
ranges version
ratio climits
+ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1871,6 +1856,7 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
+semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2124,6 +2110,7 @@ stop_token cstdint
stop_token cstdlib
stop_token cstring
stop_token ctime
+stop_token initializer_list
stop_token iosfwd
stop_token limits
stop_token ratio
@@ -2446,6 +2433,7 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
+type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 861fd2bb9ba98f..9937ad09629de9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -27,11 +27,13 @@ array cctype
array compare
array cstddef
array cstdint
+array cstring
array cwchar
array cwctype
array initializer_list
array limits
array new
+array optional
array stdexcept
array version
atomic climits
@@ -67,6 +69,7 @@ bitset initializer_list
bitset iosfwd
bitset limits
bitset new
+bitset optional
bitset stdexcept
bitset string
bitset string_view
@@ -95,6 +98,7 @@ ccomplex istream
ccomplex limits
ccomplex locale
ccomplex new
+ccomplex optional
ccomplex ratio
ccomplex sstream
ccomplex stdexcept
@@ -148,6 +152,9 @@ chrono typeinfo
chrono vector
chrono version
cinttypes cstdint
+cmath cstddef
+cmath cstdint
+cmath initializer_list
cmath limits
cmath version
codecvt cctype
@@ -165,6 +172,7 @@ codecvt initializer_list
codecvt iosfwd
codecvt limits
codecvt new
+codecvt optional
codecvt stdexcept
codecvt string
codecvt string_view
@@ -197,6 +205,7 @@ complex istream
complex limits
complex locale
complex new
+complex optional
complex ratio
complex sstream
complex stdexcept
@@ -224,6 +233,7 @@ condition_variable initializer_list
condition_variable iosfwd
condition_variable limits
condition_variable new
+condition_variable optional
condition_variable ratio
condition_variable stdexcept
condition_variable string
@@ -262,6 +272,7 @@ ctgmath istream
ctgmath limits
ctgmath locale
ctgmath new
+ctgmath optional
ctgmath ratio
ctgmath sstream
ctgmath stdexcept
@@ -284,6 +295,7 @@ deque cwctype
deque initializer_list
deque limits
deque new
+deque optional
deque stdexcept
deque tuple
deque version
@@ -299,35 +311,16 @@ expected cstdint
expected initializer_list
expected new
expected version
-experimental/iterator bitset
-experimental/iterator cctype
-experimental/iterator cerrno
-experimental/iterator climits
-experimental/iterator clocale
experimental/iterator compare
experimental/iterator concepts
experimental/iterator cstddef
experimental/iterator cstdint
-experimental/iterator cstdio
-experimental/iterator cstdlib
experimental/iterator cstring
-experimental/iterator ctime
-experimental/iterator cwchar
-experimental/iterator cwctype
experimental/iterator initializer_list
-experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
-experimental/iterator locale
experimental/iterator new
-experimental/iterator ratio
-experimental/iterator stdexcept
-experimental/iterator streambuf
-experimental/iterator string
-experimental/iterator string_view
-experimental/iterator tuple
-experimental/iterator typeinfo
experimental/iterator variant
experimental/iterator version
experimental/memory cstddef
@@ -374,6 +367,7 @@ filesystem istream
filesystem limits
filesystem locale
filesystem new
+filesystem optional
filesystem ratio
filesystem stdexcept
filesystem streambuf
@@ -505,6 +499,7 @@ future limits
future locale
future mutex
future new
+future optional
future ratio
future sstream
future stdexcept
@@ -538,6 +533,7 @@ iomanip istream
iomanip limits
iomanip locale
iomanip new
+iomanip optional
iomanip ratio
iomanip stdexcept
iomanip streambuf
@@ -563,6 +559,7 @@ ios initializer_list
ios iosfwd
ios limits
ios new
+ios optional
ios ratio
ios stdexcept
ios string
@@ -626,6 +623,7 @@ istream iosfwd
istream limits
istream locale
istream new
+istream optional
istream ratio
istream stdexcept
istream streambuf
@@ -684,6 +682,7 @@ locale ios
locale iosfwd
locale limits
locale new
+locale optional
locale ratio
locale stdexcept
locale streambuf
@@ -713,11 +712,13 @@ mdspan compare
mdspan concepts
mdspan cstddef
mdspan cstdint
+mdspan cstring
mdspan cwchar
mdspan cwctype
mdspan initializer_list
mdspan limits
mdspan new
+mdspan optional
mdspan span
mdspan stdexcept
mdspan version
@@ -747,6 +748,7 @@ memory_resource iosfwd
memory_resource limits
memory_resource mutex
memory_resource new
+memory_resource optional
memory_resource ratio
memory_resource stdexcept
memory_resource string
@@ -769,6 +771,7 @@ mutex initializer_list
mutex iosfwd
mutex limits
mutex new
+mutex optional
mutex ratio
mutex stdexcept
mutex string
@@ -877,6 +880,7 @@ queue initializer_list
queue iosfwd
queue limits
queue new
+queue optional
queue stdexcept
queue string
queue string_view
@@ -953,6 +957,7 @@ regex initializer_list
regex iosfwd
regex limits
regex new
+regex optional
regex stdexcept
regex string
regex string_view
@@ -1003,6 +1008,7 @@ shared_mutex initializer_list
shared_mutex iosfwd
shared_mutex limits
shared_mutex new
+shared_mutex optional
shared_mutex ratio
shared_mutex stdexcept
shared_mutex string
@@ -1037,6 +1043,7 @@ sstream istream
sstream limits
sstream locale
sstream new
+sstream optional
sstream ratio
sstream stdexcept
sstream streambuf
@@ -1056,6 +1063,7 @@ stack deque
stack initializer_list
stack limits
stack new
+stack optional
stack stdexcept
stack tuple
stack version
@@ -1086,6 +1094,7 @@ streambuf ios
streambuf iosfwd
streambuf limits
streambuf new
+streambuf optional
streambuf ratio
streambuf stdexcept
streambuf string
@@ -1106,6 +1115,7 @@ string initializer_list
string iosfwd
string limits
string new
+string optional
string stdexcept
string string_view
string tuple
@@ -1122,6 +1132,7 @@ string_view initializer_list
string_view iosfwd
string_view limits
string_view new
+string_view optional
string_view stdexcept
string_view version
strstream array
@@ -1210,6 +1221,7 @@ system_error initializer_list
system_error iosfwd
system_error limits
system_error new
+system_error optional
system_error stdexcept
system_error string
system_error string_view
@@ -1238,6 +1250,7 @@ thread istream
thread limits
thread locale
thread new
+thread optional
thread ratio
thread sstream
thread stdexcept
@@ -1252,6 +1265,7 @@ tuple cstddef
tuple cstdint
tuple limits
tuple version
+type_traits cstddef
type_traits cstdint
type_traits version
typeindex compare
@@ -1291,11 +1305,14 @@ utility initializer_list
utility limits
utility version
valarray cmath
+valarray compare
valarray cstddef
valarray cstdint
+valarray cstring
valarray initializer_list
valarray limits
valarray new
+valarray optional
valarray version
variant compare
variant cstddef
@@ -1322,6 +1339,7 @@ vector initializer_list
vector iosfwd
vector limits
vector new
+vector optional
vector stdexcept
vector string
vector string_view
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index a31139f1ee8565..9937ad09629de9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -27,11 +27,13 @@ array cctype
array compare
array cstddef
array cstdint
+array cstring
array cwchar
array cwctype
array initializer_list
array limits
array new
+array optional
array stdexcept
array version
atomic climits
@@ -67,6 +69,7 @@ bitset initializer_list
bitset iosfwd
bitset limits
bitset new
+bitset optional
bitset stdexcept
bitset string
bitset string_view
@@ -95,6 +98,7 @@ ccomplex istream
ccomplex limits
ccomplex locale
ccomplex new
+ccomplex optional
ccomplex ratio
ccomplex sstream
ccomplex stdexcept
@@ -148,6 +152,9 @@ chrono typeinfo
chrono vector
chrono version
cinttypes cstdint
+cmath cstddef
+cmath cstdint
+cmath initializer_list
cmath limits
cmath version
codecvt cctype
@@ -165,6 +172,7 @@ codecvt initializer_list
codecvt iosfwd
codecvt limits
codecvt new
+codecvt optional
codecvt stdexcept
codecvt string
codecvt string_view
@@ -197,6 +205,7 @@ complex istream
complex limits
complex locale
complex new
+complex optional
complex ratio
complex sstream
complex stdexcept
@@ -224,6 +233,7 @@ condition_variable initializer_list
condition_variable iosfwd
condition_variable limits
condition_variable new
+condition_variable optional
condition_variable ratio
condition_variable stdexcept
condition_variable string
@@ -262,6 +272,7 @@ ctgmath istream
ctgmath limits
ctgmath locale
ctgmath new
+ctgmath optional
ctgmath ratio
ctgmath sstream
ctgmath stdexcept
@@ -284,6 +295,7 @@ deque cwctype
deque initializer_list
deque limits
deque new
+deque optional
deque stdexcept
deque tuple
deque version
@@ -299,35 +311,16 @@ expected cstdint
expected initializer_list
expected new
expected version
-experimental/iterator bitset
-experimental/iterator cctype
-experimental/iterator cerrno
-experimental/iterator climits
-experimental/iterator clocale
experimental/iterator compare
experimental/iterator concepts
experimental/iterator cstddef
experimental/iterator cstdint
-experimental/iterator cstdio
-experimental/iterator cstdlib
experimental/iterator cstring
-experimental/iterator ctime
-experimental/iterator cwchar
-experimental/iterator cwctype
experimental/iterator initializer_list
-experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
-experimental/iterator locale
experimental/iterator new
-experimental/iterator ratio
-experimental/iterator stdexcept
-experimental/iterator streambuf
-experimental/iterator string
-experimental/iterator string_view
-experimental/iterator tuple
-experimental/iterator typeinfo
experimental/iterator variant
experimental/iterator version
experimental/memory cstddef
@@ -374,6 +367,7 @@ filesystem istream
filesystem limits
filesystem locale
filesystem new
+filesystem optional
filesystem ratio
filesystem stdexcept
filesystem streambuf
@@ -434,6 +428,7 @@ fstream cstring
fstream ctime
fstream cwchar
fstream cwctype
+fstream filesystem
fstream format
fstream initializer_list
fstream iomanip
@@ -504,6 +499,7 @@ future limits
future locale
future mutex
future new
+future optional
future ratio
future sstream
future stdexcept
@@ -537,6 +533,7 @@ iomanip istream
iomanip limits
iomanip locale
iomanip new
+iomanip optional
iomanip ratio
iomanip stdexcept
iomanip streambuf
@@ -562,6 +559,7 @@ ios initializer_list
ios iosfwd
ios limits
ios new
+ios optional
ios ratio
ios stdexcept
ios string
@@ -625,6 +623,7 @@ istream iosfwd
istream limits
istream locale
istream new
+istream optional
istream ratio
istream stdexcept
istream streambuf
@@ -683,6 +682,7 @@ locale ios
locale iosfwd
locale limits
locale new
+locale optional
locale ratio
locale stdexcept
locale streambuf
@@ -712,11 +712,13 @@ mdspan compare
mdspan concepts
mdspan cstddef
mdspan cstdint
+mdspan cstring
mdspan cwchar
mdspan cwctype
mdspan initializer_list
mdspan limits
mdspan new
+mdspan optional
mdspan span
mdspan stdexcept
mdspan version
@@ -746,6 +748,7 @@ memory_resource iosfwd
memory_resource limits
memory_resource mutex
memory_resource new
+memory_resource optional
memory_resource ratio
memory_resource stdexcept
memory_resource string
@@ -768,6 +771,7 @@ mutex initializer_list
mutex iosfwd
mutex limits
mutex new
+mutex optional
mutex ratio
mutex stdexcept
mutex string
@@ -876,6 +880,7 @@ queue initializer_list
queue iosfwd
queue limits
queue new
+queue optional
queue stdexcept
queue string
queue string_view
@@ -952,6 +957,7 @@ regex initializer_list
regex iosfwd
regex limits
regex new
+regex optional
regex stdexcept
regex string
regex string_view
@@ -1002,6 +1008,7 @@ shared_mutex initializer_list
shared_mutex iosfwd
shared_mutex limits
shared_mutex new
+shared_mutex optional
shared_mutex ratio
shared_mutex stdexcept
shared_mutex string
@@ -1036,6 +1043,7 @@ sstream istream
sstream limits
sstream locale
sstream new
+sstream optional
sstream ratio
sstream stdexcept
sstream streambuf
@@ -1055,6 +1063,7 @@ stack deque
stack initializer_list
stack limits
stack new
+stack optional
stack stdexcept
stack tuple
stack version
@@ -1085,6 +1094,7 @@ streambuf ios
streambuf iosfwd
streambuf limits
streambuf new
+streambuf optional
streambuf ratio
streambuf stdexcept
streambuf string
@@ -1105,6 +1115,7 @@ string initializer_list
string iosfwd
string limits
string new
+string optional
string stdexcept
string string_view
string tuple
@@ -1121,6 +1132,7 @@ string_view initializer_list
string_view iosfwd
string_view limits
string_view new
+string_view optional
string_view stdexcept
string_view version
strstream array
@@ -1209,6 +1221,7 @@ system_error initializer_list
system_error iosfwd
system_error limits
system_error new
+system_error optional
system_error stdexcept
system_error string
system_error string_view
@@ -1237,6 +1250,7 @@ thread istream
thread limits
thread locale
thread new
+thread optional
thread ratio
thread sstream
thread stdexcept
@@ -1251,6 +1265,7 @@ tuple cstddef
tuple cstdint
tuple limits
tuple version
+type_traits cstddef
type_traits cstdint
type_traits version
typeindex compare
@@ -1290,11 +1305,14 @@ utility initializer_list
utility limits
utility version
valarray cmath
+valarray compare
valarray cstddef
valarray cstdint
+valarray cstring
valarray initializer_list
valarray limits
valarray new
+valarray optional
valarray version
variant compare
variant cstddef
@@ -1321,6 +1339,7 @@ vector initializer_list
vector iosfwd
vector limits
vector new
+vector optional
vector stdexcept
vector string
vector string_view
>From c0dea45733ac588a88397deb44480eff136145d6 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 6 Oct 2024 14:33:51 +0500
Subject: [PATCH 23/24] Fixed
---
libcxx/include/__algorithm/fill.h | 5 +--
libcxx/include/__algorithm/fill_n.h | 6 +--
.../test/libcxx/transitive_includes/cxx03.csv | 36 ++++++++++++------
.../test/libcxx/transitive_includes/cxx11.csv | 36 ++++++++++++------
.../test/libcxx/transitive_includes/cxx14.csv | 37 +++++++++++++------
.../test/libcxx/transitive_includes/cxx17.csv | 35 ++++++++++++------
.../test/libcxx/transitive_includes/cxx20.csv | 36 ++++++++++++------
.../test/libcxx/transitive_includes/cxx23.csv | 24 ++++++++++--
.../test/libcxx/transitive_includes/cxx26.csv | 25 ++++++++++---
9 files changed, 168 insertions(+), 72 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index d99c7f57611a83..03161034b37e4e 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -13,6 +13,8 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__iterator/segmented_iterator.h>
+#include <__type_traits/enable_if.h>
+#include <__algorithm/fill_n.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -21,9 +23,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
-template <class _OutputIterator, class _Size, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
-fill_n(_OutputIterator __first, _Size __n, const _Tp& __value);
template < class _ForwardIterator,
class _Tp,
diff --git a/libcxx/include/__algorithm/fill_n.h b/libcxx/include/__algorithm/fill_n.h
index f18569748469b0..5abbc946ed3c29 100644
--- a/libcxx/include/__algorithm/fill_n.h
+++ b/libcxx/include/__algorithm/fill_n.h
@@ -17,6 +17,7 @@
#include <__memory/pointer_traits.h>
#include <__type_traits/enable_if.h>
#include <__utility/convert_to_integral.h>
+#include <__algorithm/for_each.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -28,9 +29,6 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
// fill_n isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
-template <class _ForwardIterator, class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
-fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
template <class _OutputIterator,
class _Size,
@@ -109,7 +107,7 @@ template <class _OutputIterator,
__enable_if_t<__is_segmented_iterator<_OutputIterator>::value, int> >
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value) {
- std::fill(__first, __first + __n, __value);
+ std::for_each(__first, __first + __n, [__value](_Tp& __val) { __val = __value; });
return __n > 0 ? __first + __n : __first;
}
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index fc1e6d3f4f89a6..506b5cd02c4495 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -115,7 +115,6 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
-atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -145,7 +144,6 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
-bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -303,9 +301,7 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
-cmath cstddef
cmath cstdint
-cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -350,7 +346,6 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
-compare initializer_list
compare limits
compare type_traits
compare version
@@ -453,7 +448,6 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
-coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -583,19 +577,43 @@ expected initializer_list
expected new
expected type_traits
expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
+experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
+experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
+experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -786,6 +804,7 @@ fstream filesystem
fstream format
fstream functional
fstream initializer_list
+fstream iomanip
fstream ios
fstream iosfwd
fstream istream
@@ -1146,12 +1165,10 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
-latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
-limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1760,7 +1777,6 @@ ranges variant
ranges vector
ranges version
ratio climits
-ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1845,7 +1861,6 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
-semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2411,7 +2426,6 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index fc1e6d3f4f89a6..506b5cd02c4495 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -115,7 +115,6 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
-atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -145,7 +144,6 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
-bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -303,9 +301,7 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
-cmath cstddef
cmath cstdint
-cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -350,7 +346,6 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
-compare initializer_list
compare limits
compare type_traits
compare version
@@ -453,7 +448,6 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
-coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -583,19 +577,43 @@ expected initializer_list
expected new
expected type_traits
expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
+experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
+experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
+experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -786,6 +804,7 @@ fstream filesystem
fstream format
fstream functional
fstream initializer_list
+fstream iomanip
fstream ios
fstream iosfwd
fstream istream
@@ -1146,12 +1165,10 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
-latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
-limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1760,7 +1777,6 @@ ranges variant
ranges vector
ranges version
ratio climits
-ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1845,7 +1861,6 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
-semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2411,7 +2426,6 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index fcdaa82dfa5299..828e1d62c6ec3e 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -118,7 +118,6 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
-atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -148,7 +147,6 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
-bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -309,9 +307,7 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
-cmath cstddef
cmath cstdint
-cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -357,7 +353,6 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
-compare initializer_list
compare limits
compare type_traits
compare version
@@ -462,7 +457,6 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
-coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -594,19 +588,44 @@ expected initializer_list
expected new
expected type_traits
expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
+experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
+experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
experimental/iterator exception
+experimental/iterator execution
experimental/iterator initializer_list
+experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -806,6 +825,7 @@ fstream filesystem
fstream format
fstream functional
fstream initializer_list
+fstream iomanip
fstream ios
fstream iosfwd
fstream istream
@@ -1172,12 +1192,10 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
-latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
-limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1796,7 +1814,6 @@ ranges variant
ranges vector
ranges version
ratio climits
-ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1882,7 +1899,6 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
-semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2460,7 +2476,6 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 79563407442d6a..0bee6e9beb7af1 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -115,7 +115,6 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
-atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -145,7 +144,6 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
-bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -303,9 +301,7 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
-cmath cstddef
cmath cstdint
-cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -350,7 +346,6 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
-compare initializer_list
compare limits
compare type_traits
compare version
@@ -453,7 +448,6 @@ coroutine cmath
coroutine compare
coroutine cstddef
coroutine cstdint
-coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -583,19 +577,43 @@ expected initializer_list
expected new
expected type_traits
expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
+experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
+experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
+experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -1171,12 +1189,10 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
-latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
-limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1785,7 +1801,6 @@ ranges variant
ranges vector
ranges version
ratio climits
-ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1870,7 +1885,6 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
-semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2436,7 +2450,6 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 0c16810f437b4c..026c26f3bd9819 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -92,7 +92,6 @@ atomic cstdint
atomic cstdlib
atomic cstring
atomic ctime
-atomic initializer_list
atomic limits
atomic ratio
atomic type_traits
@@ -122,7 +121,6 @@ barrier typeinfo
barrier utility
barrier variant
barrier version
-bit cstddef
bit cstdint
bit cstdlib
bit iosfwd
@@ -290,9 +288,7 @@ chrono variant
chrono vector
chrono version
cinttypes cstdint
-cmath cstddef
cmath cstdint
-cmath initializer_list
cmath limits
cmath type_traits
cmath version
@@ -337,7 +333,6 @@ codecvt version
compare cmath
compare cstddef
compare cstdint
-compare initializer_list
compare limits
compare type_traits
compare version
@@ -441,7 +436,6 @@ coroutine compare
coroutine cstddef
coroutine cstdint
coroutine cstring
-coroutine initializer_list
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -571,19 +565,43 @@ expected initializer_list
expected new
expected type_traits
expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
experimental/iterator cmath
experimental/iterator compare
experimental/iterator concepts
+experimental/iterator cstdarg
experimental/iterator cstddef
experimental/iterator cstdint
+experimental/iterator cstdio
experimental/iterator cstdlib
experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
experimental/iterator exception
experimental/iterator initializer_list
+experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
experimental/iterator tuple
experimental/iterator type_traits
experimental/iterator typeinfo
@@ -1157,12 +1175,10 @@ latch cstdint
latch cstdlib
latch cstring
latch ctime
-latch initializer_list
latch limits
latch ratio
latch type_traits
latch version
-limits cstddef
limits cstdint
limits type_traits
limits version
@@ -1771,7 +1787,6 @@ ranges variant
ranges vector
ranges version
ratio climits
-ratio cstddef
ratio cstdint
ratio type_traits
ratio version
@@ -1856,7 +1871,6 @@ semaphore cstdint
semaphore cstdlib
semaphore cstring
semaphore ctime
-semaphore initializer_list
semaphore limits
semaphore ratio
semaphore type_traits
@@ -2110,7 +2124,6 @@ stop_token cstdint
stop_token cstdlib
stop_token cstring
stop_token ctime
-stop_token initializer_list
stop_token iosfwd
stop_token limits
stop_token ratio
@@ -2433,7 +2446,6 @@ tuple type_traits
tuple typeinfo
tuple utility
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex cmath
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 9937ad09629de9..6becb4f42626de 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -152,9 +152,6 @@ chrono typeinfo
chrono vector
chrono version
cinttypes cstdint
-cmath cstddef
-cmath cstdint
-cmath initializer_list
cmath limits
cmath version
codecvt cctype
@@ -311,16 +308,36 @@ expected cstdint
expected initializer_list
expected new
expected version
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
experimental/iterator compare
experimental/iterator concepts
experimental/iterator cstddef
experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
experimental/iterator initializer_list
+experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
+experimental/iterator locale
experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator tuple
+experimental/iterator typeinfo
experimental/iterator variant
experimental/iterator version
experimental/memory cstddef
@@ -1265,7 +1282,6 @@ tuple cstddef
tuple cstdint
tuple limits
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex compare
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 9937ad09629de9..9057ce6b1558cc 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -152,9 +152,6 @@ chrono typeinfo
chrono vector
chrono version
cinttypes cstdint
-cmath cstddef
-cmath cstdint
-cmath initializer_list
cmath limits
cmath version
codecvt cctype
@@ -311,16 +308,36 @@ expected cstdint
expected initializer_list
expected new
expected version
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
experimental/iterator compare
experimental/iterator concepts
experimental/iterator cstddef
experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
experimental/iterator initializer_list
+experimental/iterator ios
experimental/iterator iosfwd
experimental/iterator iterator
experimental/iterator limits
+experimental/iterator locale
experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator tuple
+experimental/iterator typeinfo
experimental/iterator variant
experimental/iterator version
experimental/memory cstddef
@@ -428,7 +445,6 @@ fstream cstring
fstream ctime
fstream cwchar
fstream cwctype
-fstream filesystem
fstream format
fstream initializer_list
fstream iomanip
@@ -1265,7 +1281,6 @@ tuple cstddef
tuple cstdint
tuple limits
tuple version
-type_traits cstddef
type_traits cstdint
type_traits version
typeindex compare
>From 84a34c79d15d93ebfbac1b3c3c2fbf36ed795b67 Mon Sep 17 00:00:00 2001
From: nouman-10x <noumanamir453 at gmail.com>
Date: Sun, 6 Oct 2024 14:45:03 +0500
Subject: [PATCH 24/24] Formatted
---
libcxx/include/__algorithm/fill.h | 2 +-
libcxx/include/__algorithm/fill_n.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libcxx/include/__algorithm/fill.h b/libcxx/include/__algorithm/fill.h
index 03161034b37e4e..93aa980d8f12dc 100644
--- a/libcxx/include/__algorithm/fill.h
+++ b/libcxx/include/__algorithm/fill.h
@@ -9,12 +9,12 @@
#ifndef _LIBCPP___ALGORITHM_FILL_H
#define _LIBCPP___ALGORITHM_FILL_H
+#include <__algorithm/fill_n.h>
#include <__algorithm/for_each.h>
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__iterator/segmented_iterator.h>
#include <__type_traits/enable_if.h>
-#include <__algorithm/fill_n.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__algorithm/fill_n.h b/libcxx/include/__algorithm/fill_n.h
index 5abbc946ed3c29..cb5f00dfd2c826 100644
--- a/libcxx/include/__algorithm/fill_n.h
+++ b/libcxx/include/__algorithm/fill_n.h
@@ -9,6 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_FILL_N_H
#define _LIBCPP___ALGORITHM_FILL_N_H
+#include <__algorithm/for_each.h>
#include <__algorithm/min.h>
#include <__config>
#include <__fwd/bit_reference.h>
@@ -17,7 +18,6 @@
#include <__memory/pointer_traits.h>
#include <__type_traits/enable_if.h>
#include <__utility/convert_to_integral.h>
-#include <__algorithm/for_each.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
More information about the libcxx-commits
mailing list