Type tuple pointers

Alex Parrill via Digitalmars-d digitalmars-d at puremagic.com
Thu May 21 08:30:57 PDT 2015


On Thursday, 21 May 2015 at 14:55:21 UTC, Freddy wrote:
> Why don't pointers and .sizeof work with typetuples
> ----
> import std.typetuple;
> void main(){
>     TypeTuple!(int,char)* test;
>     TypeTuple!(long,int).sizeof;
> }
> ----
> $ rdmd test
> test.d(3): Error: can't have pointer to (int, char)
> test.d(4): Error: no property 'sizeof' for tuple '(long, int)'
> Failed: ["dmd", "-v", "-o-", "test.d", "-I."]
>
> I know they can be wrapped in structs but shouldn't this work 
> in the first place.

'Type' tuples are compile-time tuples of types, values, and 
aliases. They aren't types themselves, so `TypeTuple!(int, char) 
var` doesn't make sense.

I think you want regular tuples from std.typecons.


More information about the Digitalmars-d mailing list