On Wednesday, November 15, 2017 22:48:12 unleashy via Digitalmars-d-learn
wrote:
> On Wednesday, 15 November 2017 at 21:02:35 UTC, Jonathan M Davis
> wrote:
> > If you specifically want a function to accept a range and
> > mutate it without returning it, then it should take its
> > argument by ref
Thanks for the insights everyone, it really helped!
I actually discovered that it wasn't working because one of the
parsing functions used `std.range.take` and, since I was giving
it a slice, `take` decided to save the fwdrange instead of
mutating it. I realised the `take` call was 100% useles
On 11/15/2017 01:02 PM, Jonathan M Davis wrote:
> On Wednesday, November 15, 2017 20:53:39 unleashy via Digitalmars-d-learn
>> ubyte[] slice;
>> ...
>> int a = readInt(slice);
>> double b = readDouble(slice);
>>
>> Ends up failing, because readInt properly reads an int, but the
>> slice is not mu
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/
On Wednesday, November 15, 2017 20:53:39 unleashy via Digitalmars-d-learn
wrote:
> Hello,
>
> I'm writing a small parser for a specific binary format. The
> format is parsed by way of a sequence of functions, each
> deserializing a small portion of the format into a D type such as
> int, double, s
Hello,
I'm writing a small parser for a specific binary format. The
format is parsed by way of a sequence of functions, each
deserializing a small portion of the format into a D type such as
int, double, string, etc., operating on a single InputRange. The
problem is, if I pass a slice to each