<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/libcxx/include/algorithm, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[libc++] Backport segmented iterator optimization for std::for_each to C++11 (#134960)</title>
<updated>2025-04-19T11:12:43+00:00</updated>
<author>
<name>Peng Liu</name>
<email>winner245@hotmail.com</email>
</author>
<published>2025-04-19T11:12:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e9280a1d39af88468ffea9a14fad5bf96d51d6e6'/>
<id>e9280a1d39af88468ffea9a14fad5bf96d51d6e6</id>
<content type='text'>
Previously, the segmented iterator optimization for `std::for_each` was restricted to C++23 and later due to its dependency on `__movable_box`, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11. 

By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to `std::for_each`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the segmented iterator optimization for `std::for_each` was restricted to C++23 and later due to its dependency on `__movable_box`, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11. 

By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to `std::for_each`.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Implement ranges::iota (#68494)</title>
<updated>2025-04-05T11:46:11+00:00</updated>
<author>
<name>James E T Smith</name>
<email>jamesETsmith@users.noreply.github.com</email>
</author>
<published>2025-04-05T11:46:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=475cbf0ad6e72f33e5ba5890a1c6e84e39a19e83'/>
<id>475cbf0ad6e72f33e5ba5890a1c6e84e39a19e83</id>
<content type='text'>
# Overview

As a disclaimer, this is my first PR to LLVM and while I've tried to
ensure I've followed the LLVM and libc++ contributing guidelines,
there's probably a good chance I missed something. If I have, just let
me know and I'll try to correct it as soon as I can.

This PR implements `std::ranges::iota` and
`std::ranges::out_value_result` outlined in
[P2440r1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2440r1.html).

As outlined in the paper above, I've:
- Implemented `out_value_result` and added to `&lt;algorithm&gt;`
- Added `out_value_result`, `iota_result`, and two overloads of `iota`
to `std::ranges` in `&lt;numeric&gt;`
- Updated the version macro `__cpp_lib_ranges_iota` in `&lt;version&gt;`

I've also added tests for `ranges::iota` and `ranges::out_value_result`.
Lastly, I added those structs to the appropriate module files.

Partially implements #105184

EDIT: Forgot to mention in the original post, thanks to @hawkinsw for
taking a look at a preliminary version of this PR!

# TODOs
- [x] Updating the range [status
doc](https://github.com/jamesETsmith/llvm-project/blob/main/libcxx/docs/Status/RangesMajorFeatures.csv)
- [x] Ensure all comments from https://reviews.llvm.org/D121436 are
addressed here
- [X] EDIT (I'll do this in a separate PR). ~~I'm open to implementing
the rest of P2440r1 (`ranges::shift_left` and `ranges::shift_right`) if
that's ok, I just wanted to get feedback on `ranges::iota` first~~
- [x] I've been having trouble building the modules locally and want to
make sure that's working properly

Closes: #134060</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
# Overview

As a disclaimer, this is my first PR to LLVM and while I've tried to
ensure I've followed the LLVM and libc++ contributing guidelines,
there's probably a good chance I missed something. If I have, just let
me know and I'll try to correct it as soon as I can.

This PR implements `std::ranges::iota` and
`std::ranges::out_value_result` outlined in
[P2440r1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2440r1.html).

As outlined in the paper above, I've:
- Implemented `out_value_result` and added to `&lt;algorithm&gt;`
- Added `out_value_result`, `iota_result`, and two overloads of `iota`
to `std::ranges` in `&lt;numeric&gt;`
- Updated the version macro `__cpp_lib_ranges_iota` in `&lt;version&gt;`

I've also added tests for `ranges::iota` and `ranges::out_value_result`.
Lastly, I added those structs to the appropriate module files.

Partially implements #105184

EDIT: Forgot to mention in the original post, thanks to @hawkinsw for
taking a look at a preliminary version of this PR!

# TODOs
- [x] Updating the range [status
doc](https://github.com/jamesETsmith/llvm-project/blob/main/libcxx/docs/Status/RangesMajorFeatures.csv)
- [x] Ensure all comments from https://reviews.llvm.org/D121436 are
addressed here
- [X] EDIT (I'll do this in a separate PR). ~~I'm open to implementing
the rest of P2440r1 (`ranges::shift_left` and `ranges::shift_right`) if
that's ok, I just wanted to get feedback on `ranges::iota` first~~
- [x] I've been having trouble building the modules locally and want to
make sure that's working properly

Closes: #134060</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Implement part of P2562R1: constexpr `ranges::inplace_merge` (#131947)</title>
<updated>2025-03-19T17:59:32+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2025-03-19T17:59:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=053a714adda3e1d3d506f417c7fbc6eb3fa75405'/>
<id>053a714adda3e1d3d506f417c7fbc6eb3fa75405</id>
<content type='text'>
Drive-by changes:
- Consistently mark `std::__inplace_merge::__inplace_merge_impl`
`_LIBCPP_CONSTEXPR_SINCE_CXX26`.
- This function template is only called by other functions that becomes
constexpr since C++26, and it itself calls `std::__inplace_merge` that
is constexpr since C++26.
- Unblock related test coverage in constant evaluation for
`stable_partition`, `ranges::stable_sort`, `std::stable_sort`,
`std::stable_partition`, and `std::inplace_merge`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Drive-by changes:
- Consistently mark `std::__inplace_merge::__inplace_merge_impl`
`_LIBCPP_CONSTEXPR_SINCE_CXX26`.
- This function template is only called by other functions that becomes
constexpr since C++26, and it itself calls `std::__inplace_merge` that
is constexpr since C++26.
- Unblock related test coverage in constant evaluation for
`stable_partition`, `ranges::stable_sort`, `std::stable_sort`,
`std::stable_partition`, and `std::inplace_merge`.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Implement part of P2562R1: constexpr `std::inplace_merge` (#129008)</title>
<updated>2025-03-18T23:42:23+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2025-03-18T23:42:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=854a4f2bbb06ba11fc45b6423ba470d07f247b20'/>
<id>854a4f2bbb06ba11fc45b6423ba470d07f247b20</id>
<content type='text'>
Drive-by:
- Adds `constexpr_random.h` for pseudo-randomizing or shuffling in tests
for constant evaluation.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Drive-by:
- Adds `constexpr_random.h` for pseudo-randomizing or shuffling in tests
for constant evaluation.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Implement part of P2562R1: constexpr `ranges::stable_sort` (#128860)</title>
<updated>2025-03-06T17:27:48+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2025-03-06T17:27:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ba9aeedf8e4b0ae3a62ee5a2234205b203f1286f'/>
<id>ba9aeedf8e4b0ae3a62ee5a2234205b203f1286f</id>
<content type='text'>
Drive-by: Enables test coverage for `ranges::stable_sort` with proxy
iterators, and changes "constexpr in" to "constexpr since" in comments
in `&lt;algorithm&gt;`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Drive-by: Enables test coverage for `ranges::stable_sort` with proxy
iterators, and changes "constexpr in" to "constexpr since" in comments
in `&lt;algorithm&gt;`.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Implement part of P2562R1: constexpr `ranges::stable_partition` (#129839)</title>
<updated>2025-03-06T01:23:55+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2025-03-06T01:23:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c28c5089628a443e0f848c2860f5e59e68efe301'/>
<id>c28c5089628a443e0f848c2860f5e59e68efe301</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Implement part of P2562R1: constexpr `std::stable_partition` (#128868)</title>
<updated>2025-03-04T01:23:29+00:00</updated>
<author>
<name>A. Jiang</name>
<email>de34@live.cn</email>
</author>
<published>2025-03-04T01:23:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=bf9bf291a3174a3c7b50ec37ddf5782767827c61'/>
<id>bf9bf291a3174a3c7b50ec37ddf5782767827c61</id>
<content type='text'>
Drive-by changes:
- Enables no-memory case for Clang.
- Enables `robust_re_difference_type.compile.pass.cpp` and
`robust_against_proxy_iterators_lifetime_bugs.pass.cpp` test coverage
for `std::stable_sort` in constant evaluation since C++26. The changes
were missing in the PR making `std::stable_sort` `constexpr`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Drive-by changes:
- Enables no-memory case for Clang.
- Enables `robust_re_difference_type.compile.pass.cpp` and
`robust_against_proxy_iterators_lifetime_bugs.pass.cpp` test coverage
for `std::stable_sort` in constant evaluation since C++26. The changes
were missing in the PR making `std::stable_sort` `constexpr`.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Make std::stable_sort constexpr friendly (#110320)</title>
<updated>2025-01-14T15:24:35+00:00</updated>
<author>
<name>PaulXiCao</name>
<email>paulxicao7@gmail.com</email>
</author>
<published>2025-01-14T15:24:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=438e2ccd4ad18d23fc800d0ad9f4f667a547f868'/>
<id>438e2ccd4ad18d23fc800d0ad9f4f667a547f868</id>
<content type='text'>
Implementing `constexpr std::stable_sort`. This is part of P2562R1,
tracked via issue #105360.

Closes #119394

Co-authored-by: A. Jiang &lt;de34@live.cn&gt;
Co-authored-by: Louis Dionne &lt;ldionne.2@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implementing `constexpr std::stable_sort`. This is part of P2562R1,
tracked via issue #105360.

Closes #119394

Co-authored-by: A. Jiang &lt;de34@live.cn&gt;
Co-authored-by: Louis Dionne &lt;ldionne.2@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)</title>
<updated>2024-12-21T12:01:48+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2024-12-21T12:01:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b9a2658a3e8bd13b0f9e7a8a440832a95b377216'/>
<id>b9a2658a3e8bd13b0f9e7a8a440832a95b377216</id>
<content type='text'>
This patch implements the forwarding to frozen C++03 headers as
discussed in
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc. In the
RFC, we initially proposed selecting the right headers from the Clang
driver, however consensus seemed to steer towards handling this in the
library itself. This patch implements that direction.

At a high level, the changes basically amount to making each public
header look like this:

```
// inside &lt;vector&gt;
#ifdef _LIBCPP_CXX03_LANG
#  include &lt;__cxx03/vector&gt;
#else
  // normal &lt;vector&gt; content
#endif
```

In most cases, public headers are simple umbrella headers so there isn't
much code in the #else branch. In other cases, the #else branch contains
the actual implementation of the header.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch implements the forwarding to frozen C++03 headers as
discussed in
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc. In the
RFC, we initially proposed selecting the right headers from the Clang
driver, however consensus seemed to steer towards handling this in the
library itself. This patch implements that direction.

At a high level, the changes basically amount to making each public
header look like this:

```
// inside &lt;vector&gt;
#ifdef _LIBCPP_CXX03_LANG
#  include &lt;__cxx03/vector&gt;
#else
  // normal &lt;vector&gt; content
#endif
```

In most cases, public headers are simple umbrella headers so there isn't
much code in the #else branch. In other cases, the #else branch contains
the actual implementation of the header.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc++] Add #if 0 block to all the top-level headers (#119234)</title>
<updated>2024-12-10T15:02:12+00:00</updated>
<author>
<name>Nikolas Klauser</name>
<email>nikolasklauser@berlin.de</email>
</author>
<published>2024-12-10T15:02:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c166a9c713ec86b86f1f178a5133bc128fd0a610'/>
<id>c166a9c713ec86b86f1f178a5133bc128fd0a610</id>
<content type='text'>
Including The frozen C++03 headers results in a lot of formatting
changes in the main headers, so this splits these changes into a
separate commit instead.

This is part of
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Including The frozen C++03 headers results in a lot of formatting
changes in the main headers, so this splits these changes into a
separate commit instead.

This is part of
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.</pre>
</div>
</content>
</entry>
</feed>
