The following trivial code is failing:
#include <vector>
#include <range/v3/all.hpp>
int main()
{
std::vector<int> const v{ 1, 2, 3, 4 };
ranges::any_view<int, ranges::category::bidirectional |
ranges::category::sized> const a{v};
ranges::begin(a);
}
but if remove the constant here:
a { v };
everything is OK. Is it a bug? Or do I not understand the semantics of any_view.
UPD: This is MSVC 16.9.0 Preview 1.0 compiler.
ranges::begin(a)invokesthat expects modifiable or r-value parameter
r.adeclared asconst a{v}would callranges::_begin_::fn::operator ()<const ranges::any_view<...>>(const ranges::any_view<...> && r)that is not possible since it would bind r-valueato l-value parameter.