Missing views::enumerate

Hello

Some simple views like enumerate and iota can make for loops in source code much more readable, which I think is important for developers everywhere. Could they be implemented please ?

Is there a way for me to add them ? I use clang64 environment in msys2, and I tried to manually include libstdc++ headers, but I get other errors about __is_constexpr_eval() being re-declared with different specifiers…

I agree they are nice to have. There is a review for iota. I don’t recall an enumerate patch.

You can add enumerate by implementing them and providing a patch for libc++. Note due to incompatible licenses you can’t copy libstdc++'s code in libc++. Otherwise they will be added at some point, when somebody wants to do the work (and has time to do it).

We have https://github.com/llvm/llvm-project/pull/73617 open for views::enumerate, but no patch for views::iota (Mark linked a patch for ranges::iota).

Oh, thank you very much ! So glad to see the patches are available, they look non-trivial to me… ! I hope they get merged soon.

I manually patched, hunk by hunk, my latest msys installation of clang64, and compilation worked as expected. (No run-time test, I only use clang for intellisense. Because the msys Windows platform library for Plug-and-Play configuration manager, cfgmgr32.h, does some unexpected stuff that is not in-line with the Microsoft equivalent…).

But some of the files in the PR I could not find in my clang installation:

  • include/modules/std/ranges.inc
  • include/modules/std/algorithm.inc
  • include/modules/std/numeric.inc

They appear to have actual source code changes, but like I said, compilation was successfull for my case, even without those changes.

Can you still tell me where do I apply those changes if I already have an official clang64 installation (from msys),. or what are the .inc files supposed to do ?

The .inc files are for the std module. That’s not shipped currently, so you shouldn’t have these files in your installation.