Range interface for std.serialization

Dmitry Olshansky dmitry.olsh at gmail.com
Sun Aug 25 01:36:37 PDT 2013


25-Aug-2013 12:20, Daniel Murphy пишет:
> "Dicebot" <public at dicebot.lv> wrote in message
> news:niufnloijwvjifusgisn at forum.dlang.org...
>> On Thursday, 22 August 2013 at 17:39:19 UTC, Johannes Pfau wrote:
>>> Yes, but the important point is that Serializer is _not_ an InputRange
>>> of serialized data. Instead it _uses_ a OutputRange / Stream
>>> internally.
>>
>> Shame on me. I have completely misunderstood you and though you want to
>> make serializer OutputRange itself.
>>
>> Your examples make a lot sense and I do agree it is a use case worth
>> supporting. Need some more time to imagine how that may impact API in
>> general.
>
> It seems to me that if you give serializer a 'put' method, it _will_ be a
> valid output range.
>
Same thoughts here.
Serializer is an output range for pretty much anything (that is 
serializable). Literally isOutputRange!T would be true for a whole lot 
of things, making it possible to dumping any ranges of Ts via copy.
Just make its put method work on a variety of types and you have it.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list