We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is a fully lazy way to do the span of string_views that doesn't require any heap.
#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; } }
The text was updated successfully, but these errors were encountered:
Previous episode's issue: #209.
Sorry, something went wrong.
main
A way of writing it that avoids the pointer arithmetic with std::views::counted:
std::views::counted
#include <ranges> #include <iostream> int main(const int argc, const char *argv[]) { for (std::string_view param : std::views::counted(argv, argc)) { std::cout << param; } }
(Check that codegen is identical on Compiler Explorer)
No branches or pull requests
Here is a fully lazy way to do the span of string_views that doesn't require any heap.
The text was updated successfully, but these errors were encountered: