
3 Dec
2008
3 Dec
'08
7:50 p.m.
David Abrahams wrote:
Seems to me, requiring empty() in ranges is sort of equivalent to requiring iterators to support distance.
Does removing empty from the range concept prevent the empty algorithm from being specialized for ranges with a more efficient way to determine calculate empty? For instance a vector-like range might store a pointer to the first element and a element count in this case empty is bool empty() const { return !count; } where as the default range empty is equivalent to writing empty as bool empty() const { return p != p+count; } perhaps there is a range refinement which can support ranges which have a more efficient empty? -- Michael Marcin