
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:02b001c554cd$47504940$6401a8c0@pdimov2... | Thorsten Ottosen wrote: | > Eric Niebler <eric <at> boost-consulting.com> writes: | > | >> Also it requires users to #include <iterator> in order to use the new | >> looping construct. There's precedent for that, though, because users | >> must #include <typeinfo> to use typeid. I can't decide how I feel | >> about that. Perhaps there's another way. | > | > I spoke with several implementers and they all said that we need to | > include some special header...otherwise it is very problematic to let | > the compiler and standard library work together. | | That's a consequence of the complexity of the proposal. Something like: | | | | for( [type] [identifier] : [expr] ) | [statement] | | Let e of type E be the value of [expr]. For each iterator i in the range | | - [ e.begin(), e.end() ) when E is not an array type; | - [ e, e + N ) when E is T[N], | | executes the compound statement | | { | [type] [identifier] = *i; | [statement] | } | | | | doesn't require library support. but it wouldn't work with pair<iterator,iterator> without an adapter. | 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. -Thorsten