Struct Flattening

bearophile bearophileHUGS at lycos.com
Wed Apr 22 07:00:14 PDT 2009


dsimcha:
> I guess I should clarify:  Getting the flattened type tuple is the easy part.  He
> hard part is getting the flattened parameter tuple, i.e. how do I copy all the
> data over to the new Joint!(uint[], uint[], uint[]) struct in a generic way?

On D1 I did solve such problem, take a look at the Xchain class into the func.d module in my dlibs:
http://www.fantascienza.net/leonardo/so/libs_d.zip
xchain(xchain(s1, s2), s3) === xchain(s1, s2, s3)

Better still is to use the Xchainable class mixin, that gives better syntax:
s1 ~ s2 ~ s3  === xchain(xchain(s1, s2), s3) === xchain(s1, s2, s3)

Bye,
bearophile



More information about the Digitalmars-d mailing list