On 2009-04-06 18:29:50 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:
for (auto copy = range[]; !copy.empty; copy.popFront)
{
auto e = copy.front;
body
}
Perhaps it's a little off topic, but...
Wouldn't it be better if the language was made so that evaluating an
array as a bool would yeild false when empty and true when not? This
would avoid forcing the !empty double negation at many places like this
one.
while (range) range.popFront;
instead of
while (!range.empty) range.popFront;
and
for (auto copy = range[]; copy; copy.popFront)
instead of
for (auto copy = range[]; !copy.empty; copy.popFront)
--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/