Re: Convert output range to input range

2018-03-18 Thread Paolo Invernizzi via Digitalmars-d-learn
On Saturday, 17 March 2018 at 17:51:50 UTC, John Chapman wrote: I'm trying to replace the old std.streams in my app with ranges. I'm interfacing with a networking library to which I supply a callback that when invoked provides the requested data. I write that data to an output range, but

Re: Convert output range to input range

2018-03-17 Thread John Chapman via Digitalmars-d-learn
On Saturday, 17 March 2018 at 17:16:40 UTC, David Nadlinger wrote: On Friday, 16 March 2018 at 07:57:04 UTC, John Chapman wrote: I need to write to a range created with outputRangeObject, then read from it. Is there a way to convert it to an input range? Could you illustrate your problem a

Re: Convert output range to input range

2018-03-17 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 16 March 2018 at 07:57:04 UTC, John Chapman wrote: I need to write to a range created with outputRangeObject, then read from it. Is there a way to convert it to an input range? Could you illustrate your problem a bit further? In the literal sense, converting from an output to an

Re: Convert output range to input range

2018-03-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 17, 2018 06:58:04 Dukc via Digitalmars-d-learn wrote: > On Friday, 16 March 2018 at 08:07:09 UTC, Jonathan M Davis wrote: > > For instance, std.array.Appender is an output range, and you > > get a dynamic array out of it, which would be an input range. > > So, if you have

Re: Convert output range to input range

2018-03-17 Thread Dukc via Digitalmars-d-learn
On Friday, 16 March 2018 at 08:07:09 UTC, Jonathan M Davis wrote: For instance, std.array.Appender is an output range, and you get a dynamic array out of it, which would be an input range. So, if you have control over what output range you're dealing with, the simplest would be to just use

Re: Convert output range to input range

2018-03-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, March 16, 2018 07:57:04 John Chapman via Digitalmars-d-learn wrote: > I need to write to a range created with outputRangeObject, then > read from it. Is there a way to convert it to an input range? The output range API only supports the put function. That's it. The output range

Convert output range to input range

2018-03-16 Thread John Chapman via Digitalmars-d-learn
I need to write to a range created with outputRangeObject, then read from it. Is there a way to convert it to an input range?