I am using clang++ 10 with GCC libstdc++ 10 prerelease. I tried compiling the example from section 24.6.4.1 [range.istream.overview]. It works with g++ 10 but with clang++ 10 -std=c++20, I get constraint-failure errors.

program:
#include <algorithm>
#include <iostream>
#include <iterator>
#include <ranges>
#include <sstream>

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

$ clang++ -std=c++20 -o range_istream_overview \
range_istream_overview.cpp

Gist of the errors is that the istream_view fails the constraints for a range because ranges::begin() fails its constraint for the basic_istream_view::begin() member function:

{ __detail::__decay_copy(__t.begin()) } -> input_or_output_iterator;

Any ideas what's wrong or how to proceed?
--
Ray Lischner
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to