ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.06k stars 437 forks source link

P2770R0 "Stashing stashing iterators for proper flattening" breaks test/view/tokenize.cpp #1771

Open StephanTLavavej opened 1 year ago

StephanTLavavej commented 1 year ago

While testing @cpplearner's implementation of C++23 P2770R0 "Stashing stashing iterators for proper flattening" in https://github.com/microsoft/STL/pull/3466 , we found that this breaks a range-v3 test. These lines now emit errors:

https://github.com/ericniebler/range-v3/blob/21b70bee785cabd3ca5e3da173bf3bdbb9df1344/test/view/tokenize.cpp#L25 https://github.com/ericniebler/range-v3/blob/21b70bee785cabd3ca5e3da173bf3bdbb9df1344/test/view/tokenize.cpp#L30

tokenize.cpp(25): error C2338: static_assert failed: 'Concept assertion failed : forward_range<decltype(rng)>'
tokenize.cpp(30): error C2338: static_assert failed: 'Concept assertion failed : forward_range<decltype(crng)>'

I believe that this is because P2770R0 marks regex_iterator and regex_token_iterator with using iterator_concept = input_iterator_tag;.

I'm working around this breaking change by updating these lines to check for only input_range, but perhaps there's a better solution.

brevzin commented 1 year ago

Hey @StephanTLavavej, thanks for the issue! If simply checking that the range is input-only rather than forward is sufficient (and the actual test that checks the content passes), then that's probably the right fix.

After all, these were always input-only to begin with - just misnamed.

No feature test macro for that paper, so I guess the test needs to just check that the resulting iterator matches regex's category.