$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Dave Harris (brangdon_at_[hidden])
Date: 2005-05-11 12:56:42
In-Reply-To: <428133DD.20505_at_[hidden]>
darren_at_[hidden] (Darren Cook) wrote (abridged):
> Wouldn't someone wanting to do something "clever" like that fall back to
> using a normal for() or while() loop? I thought for(i:vect){} is a
> convenience function to save typing and make code clearer; can it do
> something a while() loop cannot?
I don't think it makes the code clearer, because it looks like a use of i
rather than a declaration. I think it is very important for readability
that names be declared explicitly.
That is a general point. What you are proposing:
for (i: vec)
is especially misleading because it is inconsistent with:
for (i = vec.begin(); i != vec.end(); ++i)
I really don't think one should declare i and the other, not.
What's wrong with:
for (auto i: vec)
?
-- Dave Harris, Nottingham, UK.