Is there a way to check if iterator passed as arg to fnc is reverse_iterator? Are there any iterator traits function I could use?
Check if iterator's type is reverse_iterator
582 Views Asked by There is nothing we can do At
2
Is there a way to check if iterator passed as arg to fnc is reverse_iterator? Are there any iterator traits function I could use?
It's trivial to write with a partial specialization:
Although as pointed out below, this doesn't handle the (IMHO unlikely) case of a "reverse-reverse" iterator. The slightly less trivial version in Bathsheba's answer handles that case correctly.