Concatenating Tuples

dsimcha dsimcha at yahoo.com
Tue Oct 14 20:56:18 PDT 2008


== Quote from BCS (ao at pathlink.com)'s article
> Reply to dsimcha,
> > == Quote from BCS (ao at pathlink.com)'s article
> >
> >> Reply to dsimcha,
> >>
> >>> Is there a way to concatenate tuples at compile time in D2?  The
> >>> obvious ~ operator doesn't work on tuples.  Also, while I'm at it,
> >>> maybe there's a better way to achieve my end goal here.  Is there a
> >>> way to get a tuple representation of a class object that includes
> >>> the stuff from the base classes?
> >>>
> >> just put them side by side.
> >> template Tpl(T...) { alias T Tpl; }
> >> alias Tpl!(a,b,c) A;
> >> alias Tpl!(d,e,f) B;
> >> alias Tpl!(A,B) C;
> > Sorry for the poorly worded question.  What you suggested would work
> > for type tuples.  I'm looking for a way to do this for value tuples,
> > i.e. the kind you would get from Object.tupleof.
> >
> That should work there as well, if it dosn't work, it's a bug. (I think).

Sorry, you're right.  My bad.  I thought I already had tried this and it didn't
work but I guess not.  Seems to work now.



More information about the Digitalmars-d mailing list