2

I have simple istream_view and then I am trying to use ranges::copy on result.

auto t = ranges::istream_view<int>(is);
ranges::copy(t, std::back_inserter(v));

Live example on godbolt

GCC does everything ok, clang fails with error:

error: no matching function for call to object of type 'const std::ranges::__copy_fn'
  ranges::copy(t, std::back_inserter(v));

Probably it is because istream_view is moveonly view.

How to argue in this case who is right?

Standard C++20 [range.istream.overview] have similar example:

auto ints = istringstream{"0 1 2 3 4"};
ranges::copy(ranges::istream_view<int>(ints), ostream_iterator<int>{cout, "-"});

Which also fails in clang (and this is definitely a bug but I am not sure that reason is the same for both compile-time errors).

康桓瑋
  • 33,481
  • 5
  • 40
  • 90
Konstantin Vladimirov
  • 6,791
  • 1
  • 27
  • 36

0 Answers0