Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-05-10 13:51:47


Thorsten Ottosen wrote:
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
>
> | One reasonable extension
>
> perhaps. C++ is typed language.
>
> | would be to allow [type] to be omitted, with
> | semantics:
> |
> | {
> | decltype(*i) [identifier] = *i;
> | [statement]
> | }
> |
> | Note that this is not the same as auto.
>
> yep, because auto drops references.
>

But users might reasonably expect this:

int i = 0;
for( i : vect )
{
}
// maybe use i here

to use the pre-declared i as a loop variable instead of introducing a
new variable. That's an important use case, and some allowance should be
made for it in the chosen syntax.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk