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
tupleof will do what you need (mostly). However, I don't think
there will be any way to (generically) run-time zip on the
members, due to probably type mismatch, and memory layout. In any
case, nothing trivial, AFAIK.