On 2/28/13 8:44 AM, Jacob Carlborg wrote:
On 2013-02-28 12:29, Jonathan M Davis wrote:
And you were just claiming that the lexer checked the sentinel type in
only
one place. If that's indeed the case (and I think that it's quite
close to
being true if it isn't true), then you _wouldn't_ need to use static
ifs like
this in many places. So, which is it? If you need to check the
sentinel often
enough that using static ifs is a problem, then it's probably not
buying you
much of anything over checking empty anyway.
You pick a sentinel that you need to check for anyway, i.e. null or eof.
But if you don't manually add the sentinel there's nothing that says
that the sentinel will be there, and therefore you weed to check for
empty as well.
auto range = assumeWithSentinel(input);
:o)
I'm only half-joking - the awesomeness of assumeSorted suggests we could
reuse the pattern elsewhere.
Andrei