Non const-iterable reversed sequences hard error when used as a range
tcbrindle opened this issue · 0 comments
Non const-iterable reversed sequences are pretty rare, but if you find one and try to use it in a range-for loop (or anything else that calls member begin()
) it will hard error.
This is because in checking the constraints for begin() const
, it tries to check the return type of sequence_traits<reverse_adaptor>::read_at
which returns decltype(auto)
, meaning the compiler will instantiate the function to find out the return type. Unfortunately, the body of this function calls flux::prev
, which then hard errors.
There are a couple of possible solutions, but the easiest is probably to avoid decltype(auto)
and instead use decltype(<actual expression>)
so we get graceful return type SFINAE.
This is pretty much the same as #47, but with reverse_adaptor
rather than zip_adaptor
.