Closed ingo-loehken closed 2 years ago
In range-v3, views are required to be copy constructible. Move only views were added to std::ranges during standardization, and range-v3 hasn't kept up.
But placing the array
in a named var, elides the copy ctor call.
std::array const xs{1,2};
XXXX const ys;
for(auto const& [x, y] : ranges::zip_view(xs, ys)) // works, no copy for ys required
{
// ...
}
Yes, because in that case the view captures the stay by reference. No copies.
And if any rvalue is found, all args, and therefore also non copyable ys
, are copied into zip_view
?
If a temporary container is combined with a non temporary container inside a
zip_view
, it tries to copy the non temporary container. This is unexpected.This happens with the latest release (0.11.0) under msvc 16.11.5 (visual studio 2019).