std.conv.parse for user defined structs/objects
Jacob Carlborg
doob at me.com
Mon Jan 6 01:56:13 PST 2014
On 2013-12-27 20:38, Ilya Yaroshenko wrote:
> Hello!
>
> Can we introduce std.conv.parse for user defined structs/classes?
>
> I think we can define inner static method:
>
> -----------
> struct UserStruct
> {
> static typeof(this) parseImpl(Range)(Range range)
> if(...)
> {
> typeof(this) ret;
> ...
> return ret;
> }
> }
> -----------
> or something like that.
>
> And then use it in standard parse function.
>
> The reason is common parse, formattedRead and io/stdio.readf functions
> that can be used for user defined types (and for voldemort user defined
> types too!).
Isn't this starting to look like serialization?
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list