[libcxx-commits] [libcxx] [libc++] P2770R0: "Stashing stashing iterators for proper flattening" (PR #66033)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 16 18:15:55 PST 2023


================
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
----------------
ldionne wrote:

Not attached to this line: Can we add somewhere the following example from https://cplusplus.github.io/LWG/issue3698 ?

```
#include <ranges>
#include <regex>
#include <iostream>

int main() {
  char const text[] = "Hello";
  std::regex regex{"[a-z]"};

  auto lower = std::ranges::subrange(
        std::cregex_iterator(
            std::ranges::begin(text),
            std::ranges::end(text),
            regex),
        std::cregex_iterator{}
    )
    | std::views::join
    | std::views::transform([](auto const& sm) {
        return std::string_view(sm.first, sm.second);
    });

  for (auto const& sv : lower) {
    std::cout << sv << '\n';
  }
}
```

Without `cout` of course. I would put that in e.g. `libcxx/test/std/ranges/range.adaptors/range.join/LWG3698.pass.cpp`. You'll need to make that `UNSUPPORTED: no-localization` and perhaps a few others (CI should tell you) since it's using `regex`.

https://github.com/llvm/llvm-project/pull/66033


More information about the libcxx-commits mailing list