Range interface for std.serialization
Dmitry Olshansky
dmitry.olsh at gmail.com
Wed Aug 28 03:03:00 PDT 2013
28-Aug-2013 12:08, Jacob Carlborg пишет:
> On 2013-08-27 22:12, Dmitry Olshansky wrote:
>
>> Feel free to nag me on the NG and personally for any deficiency you come
>> across on the way there ;)
>
> About making Serializer a struct. Actually I think the semantics of
> Serializer should be a reference type. I see no use case in passing a
> Serializer by value. Although I do see the overhead of allocating a
> class and calling methods on it.
Here you are quite right... just add a factory that hides away its true
origin (and ctor as well so it can be changed later if need be) we.g.:
auto serializer = serializerFor!(XmlArchiver)(archiver);
> I do plan to add a free function for deserializing, for convenience. In
> that function Serializer, if it's a class, would be allocated using
> emplace to make it stack allocated.
Good idea. API should have many layers so that power users may keep
digging to the bottom and these that just need to get the job done can
do it in one stroke.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list