protocol for using InputRanges
Walter Bright
newshound2 at digitalmars.com
Thu Mar 27 02:16:58 PDT 2014
On 3/26/2014 11:48 PM, Jonathan M Davis wrote:
> However, it seems really off to me for there to be any real work going on in
> empty,
Many things, like some ttys, can not be tested for being empty without reading
it, and reading of a tty is destructive.
> and I'd be leery of any range which actually required empty to be
> called before calling front (though I definitely think that calling front on
> an empty range should not be considered okay and would expect that to
> generally be undefined behavior).
That's exactly why empty should be called before front - because front is
expected to succeed.
More information about the Digitalmars-d
mailing list