Treating a slice as an InputRange

Steven Schveighoffer schveiguy at yahoo.com
Wed Nov 15 21:11:16 UTC 2017


On 11/15/17 3:53 PM, unleashy wrote:

> So my question is, is there a way to treat a slice strictly as an 
> InputRange, so that it is mutated no matter what? Or is there another 
> way to do what I'm trying to do?

I'd model your functions after the std.conv.parse functions:

https://dlang.org/phobos/std_conv.html#parse

This always takes the range by reference, and takes the type to parse 
via a template parameter (more idiomatic D to have parse!int than parseInt).

-Steve


More information about the Digitalmars-d-learn mailing list