
30 Sep
2011
30 Sep
'11
10:04 a.m.
Andrew Sutton wrote:
template<typename I> auto f() { I i; assert(*i); } // worst algorithm ever
If I know that the iterator has valid operations after being default constructed, then I'll do as I like -- whatever the concept does or does not say.
OTOH, if I know that a singular iterator of some type would have no valid operations, and the iterator is only meant to be used by algorithms, the benefit of being unable to create a singular iterator (like when the iterator in question holds a reference to supporting data used in its operation) outweighs the benefit of being able to do so. IMHO, Chris