About foreach loops

bearophile bearophileHUGS at lycos.com
Wed Jun 15 13:40:24 PDT 2011


Don:

> The alternative would be to create __iterator1234 as const, and then 
> cast away const in the ++ step. Ugly, but would eliminate the 
> performance cost for structs.

Isn't it undefined in D to modify a const?

And Andrei suggests built-ins only:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=138718
(I think for the x..y foreach range syntax only.)

Bye,
bearophile


More information about the Digitalmars-d mailing list