On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote:
Hi,
I was able to reach all the fields in a subclass using foreach
and BaseClassesTuple, but is there a way to do this using
functional programming primitives, but in compile time for
tuples?
private template FieldNameTuple2(T) {
enum FieldNameTuple2 = BaseClassesTuple!T.map!(S =>
FieldNameTuple!S).join;
}
This is obviously wrong, but is there a way to do it?
I've searched for FieldNameTuple and BaseClassesTuple, but
without luck. It's weird because it seems like a common thing
to do.
Thanks in advance!
I think what you want is `std.meta.staticMap`. Something like
this:
alias FieldNameTuple2(T) = staticMap!(FieldNameTuple,
BaseClassesTuple!T);