On Friday, 23 May 2014 at 01:17:18 UTC, bioinfornatics wrote:
Dear,
I would like to get struct's members and zip them with an action
as
struct A
{
int a;
int b;
}
std.range.zip( __traits( allmembers, A ), [(x) => x == 0, (y) =>
y > 3] );
like this i could apply an action to each field.
I tried this:
http://dpaste.dzfl.pl/747799ffa64e
but:
tuple get by allmembers is not an input rage then i can't to
use
zip
allmembers return both fiels and method while i would like
only
fields
thanks
I change a little my mind to ease the usage.
Maybe using annotate/attribute on members will be better as:
struct A
{
@Parser(
start = "( word ) => word[0] == '>'",
end = "( word ) => word[0] == '\n'" )
string header;
}
but it seem we can't use curstom annotation in D and mxin in this
case are not easy.