[all-commits] [llvm/llvm-project] 475cbf: [libc++] Implement ranges::iota (#68494)

James E T Smith via All-commits all-commits at lists.llvm.org
Sat Apr 5 04:46:32 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 475cbf0ad6e72f33e5ba5890a1c6e84e39a19e83
      https://github.com/llvm/llvm-project/commit/475cbf0ad6e72f33e5ba5890a1c6e84e39a19e83
  Author: James E T Smith <jamesETsmith at users.noreply.github.com>
  Date:   2025-04-05 (Sat, 05 Apr 2025)

  Changed paths:
    M libcxx/docs/FeatureTestMacroTable.rst
    M libcxx/docs/Status/Cxx23.rst
    M libcxx/docs/Status/Cxx23Papers.csv
    M libcxx/include/CMakeLists.txt
    A libcxx/include/__algorithm/out_value_result.h
    A libcxx/include/__numeric/ranges_iota.h
    M libcxx/include/algorithm
    M libcxx/include/module.modulemap
    M libcxx/include/numeric
    M libcxx/include/version
    M libcxx/modules/std/algorithm.inc
    M libcxx/modules/std/numeric.inc
    M libcxx/test/std/algorithms/algorithms.results/no_unique_address.compile.pass.cpp
    A libcxx/test/std/algorithms/algorithms.results/out_value_result.pass.cpp
    M libcxx/test/std/algorithms/ranges_result_alias_declarations.compile.pass.cpp
    M libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp
    M libcxx/test/std/algorithms/ranges_robust_against_proxy_iterators.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
    A libcxx/test/std/numerics/numeric.ops/numeric.iota/ranges.iota.pass.cpp
    M libcxx/test/support/test_iterators.h
    M libcxx/utils/generate_feature_test_macro_components.py

  Log Message:
  -----------
  [libc++] Implement ranges::iota (#68494)

# 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 `<algorithm>`
- Added `out_value_result`, `iota_result`, and two overloads of `iota`
to `std::ranges` in `<numeric>`
- Updated the version macro `__cpp_lib_ranges_iota` in `<version>`

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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list