foreach over pointers OR foreach that mutates the iterator

Las via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 26 01:05:17 PST 2017


On Wednesday, 25 January 2017 at 20:22:54 UTC, Jonathan M Davis 
wrote:
> It only matters if you're trying to define the range primitives 
> for your range as free functions for some reason. Just put them 
> on the type itself and be done with it. The only reason that 
> wouldn't work would be if you weren't in control of the code 
> for the type in question, and I'm inclined to think that 
> turning a type that isn't a range into a range using free 
> functions isn't the best of ideas. You can always wrap the type 
> in another type though if you really want to turn it into a 
> range and can't just because you're dealing with a pointer.
>
> - Jonathan M Davis

Strings use std.range.primitives.


More information about the Digitalmars-d mailing list