microsoft / Range-V3-VS2015

A fork of the popular range-v3 C++ library with support for the Visual Studio 2015 Update 3 VC++ compiler.
Other
115 stars 22 forks source link

ranges::view::empty() causes "Conversion loses qualifiers" error #32

Open rdeterre opened 6 years ago

rdeterre commented 6 years ago

Hi,

I'm very new to Range v3 so this might be a misunderstanding on my end. Calling remove_if on a constant range and querying the result with empty() causes a build failure on Visual Studio 2015. Here is code that causes this:

std::vector<int> v { 6, 2, 3, 4, 5, 6 };
auto rng = v | ranges::view::remove_if([](int i) {return i>0;});
std::cout << "empty:  " << rng.empty()<< "\n";

The error is quite verbose. I copied it in the file below.

Replacing rng.empty() with rng.begin() == rng.end() makes this error go away.

The same code works on Wandbox using GCC. The version on which I see the problem is the one tagged vcpkg5.

error.log