
22 Nov
2008
22 Nov
'08
7:03 p.m.
In that case, it might be clearer to write something like
iterator_range<random_number_iterator> r(random_number_iterator(), random_number_iterator());
Here, it is explicitly initialized and thus iterator_range should know that this is not a singular range.
That is quite a pain, of course.
You've just demonstrated a common use case which now breaks, and puts a lot of pain on the user. Even if documented well, how often will the users write foo(..., SpecialIteratorRange(), ...) instead of foo(..., SpecialIteratorRange(SpecialIterator(), SpecialIterator()), ...) ? Less code is more.