Tuple basics

Derek Parnell derek at psych.ward
Sat Sep 13 01:57:52 PDT 2008


On Fri, 12 Sep 2008 21:34:25 -0400, Sam Hu wrote:

> Hi,
> 
> I seached questions regarding Tuple in this newsgroup but did not find the the same question I have.Since I am a newbie ,they are too advanced to me at this moment.My question is just :What is tuple?what can tuple do in D while  other languae like c++ can not do or can not do well?Could somebody please post a very simple code segment and an simple but enough explanation so that I can understand what the hell a tuple is .

I think that in D, a tuple is a lexical construct and not a run-time
construct. This means that it only exists while the application is being
complied and once compiled a tuple has no run-time representation. It is an
aid to writing generic code because it allows you to specify a
list/se/sequence of Types that you can address indivually as if it was an
array of types. They are Types and not Data values.

Of course, I could be totally wrong as I haven't needed to use them yet.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell


More information about the Digitalmars-d-learn mailing list