Function, signatures and tuples

Iain Buclaw ibuclaw at ubuntu.com
Sat Nov 13 00:18:45 PST 2010


== Quote from Russel Winder (russel at russel.org.uk)'s article
> On Fri, 2010-11-12 at 11:15 -0800, Andrei Alexandrescu wrote:
> > On 11/12/10 11:13 AM, Russel Winder wrote:
> > > Is there an easy explanation of why I cannot do:
> > >
> > >          real partialSum ( immutable Tuple ! ( long , long , real ) data )
> > >
> > > but instead have to do:
> > >
> > >          real partialSum ( T ... ) ( T data )
> > >
> > > to be frank I really don't get this latter which is what compiles -- I
> > > have no idea if it works yet there are other problems with my code.
> > > Specifically, how do I create an array of tuples?
> >
> > Doesn't this help?
> >
> > auto tuples = new Tuple!(long, long, real)[128];
> >
> > Tuple is a type like any other.
> I noted in a separate email that:
>         auto inputData = new Tuple ! ( long , long , real )
>         [ numberOfThreads ] ;
> causes the error message:
>         pi_d2_parallelMap.d(30): Error: template instance template 'Tuple' =
> is not defined
>         pi_d2_parallelMap.d(30): Error: Tuple!(long,long,real) is used as a type
>
> Clearly code you think is right and that is expected to work on D 2.050
> isn't working for me :-(  So either I guess there is a bug in D or, much
> more likely, I am doing something wrong.
> --
> Russel.
>

import std.typecons; ?


More information about the Digitalmars-d mailing list