Custom type / Typle type formatted reader
Rekel
paultjeadriaanse at gmail.com
Fri Jan 1 03:51:36 UTC 2021
And regarding the rest,
I'm curious about reading back user types, without defining a new
seperate method for it, such as structs, unions and tuples,
(although I'm unsure to what extent tuples are really a
user-defined-type).
The other thing just resolved itself;
I was wondering, as slurp kind of already reads tuples from
files, whether or not it's possible to tell it what tuple you
want it to read, instead of redefining a possibly previously
aliased tuple.
It seems now I found a way to do just that . . . I honestly don't
know why this went wrong before, must have made a mistake
somewhere. This now works:
alias Entry = Tuple!(int, "a", char, "b");
Entry[] results = slurp!Entry("temp.txt", "%s %s");
results.writeln;
Im actually kind of surprised it does, as nothing in the
documentation seems to hint to me this makes sense, neither did I
find any example like it elsewhere.
More information about the Digitalmars-d-learn
mailing list