digitalmars.D.learn - std.range design part of the language..?
- simendsjo (11/11) Aug 15 2010 From http://digitalmars.com/d/2.0/statement.html#ForeachStatement,
- Jonathan M Davis (4/19) Aug 15 2010 Those names are indeed out of date. It's another thing that needs to be ...
- simendsjo (2/21) Aug 15 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4649
From http://digitalmars.com/d/2.0/statement.html#ForeachStatement, "Foreach over Structs and Classes with Ranges". I read this as the Range design is a part of the language now. Is this correct? And is the spec a bit out of date in the examples? It says foreach-/reverse translates to for( auto __r = range; !__r.empty; __r.next /* or __r.retreat */) auto e = __r.head; // or __r.toe Should this be the following? for( auto __r = range; !__r.empty; __r.popFront /* or __r.popBack */) auto e = __r.front; // or __r.back
Aug 15 2010
On Sunday 15 August 2010 10:12:06 simendsjo wrote:From http://digitalmars.com/d/2.0/statement.html#ForeachStatement, "Foreach over Structs and Classes with Ranges". I read this as the Range design is a part of the language now. Is this correct? And is the spec a bit out of date in the examples? It says foreach-/reverse translates to for( auto __r = range; !__r.empty; __r.next /* or __r.retreat */) auto e = __r.head; // or __r.toe Should this be the following? for( auto __r = range; !__r.empty; __r.popFront /* or __r.popBack */) auto e = __r.front; // or __r.backThose names are indeed out of date. It's another thing that needs to be fixed in the docs. - Jonathan M Davis
Aug 15 2010
On 15.08.2010 23:58, Jonathan M Davis wrote:On Sunday 15 August 2010 10:12:06 simendsjo wrote:http://d.puremagic.com/issues/show_bug.cgi?id=4649From http://digitalmars.com/d/2.0/statement.html#ForeachStatement, "Foreach over Structs and Classes with Ranges". I read this as the Range design is a part of the language now. Is this correct? And is the spec a bit out of date in the examples? It says foreach-/reverse translates to for( auto __r = range; !__r.empty; __r.next /* or __r.retreat */) auto e = __r.head; // or __r.toe Should this be the following? for( auto __r = range; !__r.empty; __r.popFront /* or __r.popBack */) auto e = __r.front; // or __r.backThose names are indeed out of date. It's another thing that needs to be fixed in the docs. - Jonathan M Davis
Aug 15 2010