Concatenating Tuples

BCS ao at pathlink.com
Tue Oct 14 20:51:59 PDT 2008


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).





More information about the Digitalmars-d mailing list