This works:
const char* foo[] = {"This", "is", nullptr, "great"};
for (auto e : ::std::ranges::take_while_view (foo, // <- array
([](const char* s){return s!=nullptr;})))
std::cout << e << "\n";
This doesn't:
const char* foo[] = {"This", "is", nullptr, "great"};
for (auto e : ::std::ranges::take_while_view (&foo[0], // <- pointer
([](const char* s){return s!=nullptr;})))
std::cout << e << "\n";
error: no matching function for call to ‘take_while_view(const char**,
main(int, char**)::<lambda(const char*)>)’
Can we, using the standard library types and functions, coerce C++ to treat a pointer as a kind of a semi-infinite range that we can then further restrict?
I can always create my own class to represent a semi-infinite view, but I'd rather find a solution in the standard library.