tcbrindle / NanoRange

Range-based goodness for C++17
Boost Software License 1.0
358 stars 28 forks source link

Add pointer and reference typedefs to view iterators #72

Closed tcbrindle closed 5 years ago

tcbrindle commented 5 years ago

Since we're not (yet?) doing Range-V3 style "deep integration", hacking into std::iterator_traits, we need to provide all 5 typedefs in our new view iterators to use them with legacy algorithms -- or, more usefully, with container contructors.

They all have value_type, difference_type and iterator_category typedefs already, so this commit adds reference (defined to be the return type of op*) and pointer (defined to be the return type of op-> where that exists, else void).

Only the views which (can potentially) return the same type for begin() and end() need these -- others (such as istream_view) must be routed through common_iterator, which already provides the necessary typedefs.

Also, add some tests to make sure range conversion works as expected.