Here is a fully lazy way to do the span of string_views that doesn't require any heap. ```cpp #include <span> #include <ranges> #include <iostream> int main(const int argc, const char *argv[]) { for (auto param : std::span(argv, argv + argc) | std::views::transform([](const auto *c_str){ return std::string_view(c_str); })) { std::cout << param; } } ```
Activity
JohelEGP commentedon Mar 8, 2023
Previous episode's issue: #209.
localspook commentedon Aug 26, 2024
A way of writing it that avoids the pointer arithmetic with
std::views::counted:(Check that codegen is identical on Compiler Explorer)