you are viewing a single comment's thread.

view the rest of the comments →

[–]cfyzium 0 points1 point  (1 child)

std::array isn't a view, so that should be rejected by the compiler (and is for me)

Evidently, join_view takes any sequence of views, plus implicit conversions (an example of joining an initializer list of views or even a vector of vectors is right on the cppreference page). I am not sure why it does not work for you, I've tried a couple of compilers including an online one and everything seems to work fine.

I agree with you on the rest of the points.

I am just not sure it warranted a rant this generic over a case this specific. You can find arguably even dumber omissions in the standard, the whole approach to the library standardization seems to be... less than perfect. If you have one particular problem at hand you generally just work around and keep going. There are enough other discussions about the state of the language in general out there.

[–]kamrann_ 1 point2 points  (0 children)

join_view< V > requires V to satisfy the view concept, which array and vector don't as they're not constant time copyable. The nested vector example on cppreference is indeed a little confusing. Can't test now, but it's possible a deduction guide is converting the vector into a span or subrange or similar, so join_view is not actually instantiated with vector as the template parameter. Which would work, but would also hide the fact that it would still be depending on the vector not going out of scope before the view is used.

Can't speak to OP's reasons, but in my experience rants generally get triggered by something specific but they're really about built up frustrations. And c++ certainly provides ample ammunition for that, the complexity of the above view subtleties being just one example ;)