I'm implementing my own version of ranges because they are not in the standard library yet. I got stuck on implementing std::iter_difference_t
.
The latest draft says:
The type
iter_difference_t<I>
denotes
incrementable_traits<I>::difference_type
ifiterator_traits<I>
names a specialization generated from the primary template, and
iterator_traits<I>::difference_type
otherwise.
It seems like the obvious implementation is to have a concept for the first case and have 2nd case take everything else. But I have no idea how to transform this from English to C++. Can someone provide the code?