Function, signatures and tuples
Russel Winder
russel at russel.org.uk
Sat Nov 13 00:03:23 PST 2010
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.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at russel.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101113/2c47b1fa/attachment-0001.pgp>
More information about the Digitalmars-d
mailing list