Expression tuples

Steven Schveighoffer schveiguy at yahoo.com
Wed Mar 16 13:51:37 PDT 2011


On Wed, 16 Mar 2011 16:28:48 -0400, Simen kjaeraas  
<simen.kjaras at gmail.com> wrote:

> On Wed, 16 Mar 2011 21:07:08 +0100, simendsjo  
> <simen.endsjo at pandavre.com> wrote:
>
>> http://www.digitalmars.com/d/2.0/tuple.html
>>
>> // this example fails
>> Tuple!(3, 7, 'c')
>>
>> typecons.d(298): Error: static assert "Attempted to instantiate Tuple
>> with an invalid argument: 3"
>>
>> Even this fails:
>> alias Tuple!(0) T;
>>
>> Is Tuple only meant to store types or named types?
>
> std.typecons.Tuple is a value type, mostly like those tuples you find in
> other languages like Python, Haskell, etc.
> What you are likely looking for is std.typetuple.Typetuple.
>

If you read that page he is referring to, it seems like you should be able  
to create an expression tuple.

I don't know if that works with std.typecons.tuple.

In fact, I don't think I've ever seen some of the stuff that's in that  
page, especially the mixed type+expression tuple.  Is it valid?

-Steve


More information about the Digitalmars-d-learn mailing list