www.digitalmars.com         C & C++   DMDScript  

D - Real world D Template Examples?

reply John Reimer <jjreimer telus.net> writes:
I'm studying D templates, and trying to get a feel for them.  But the D 
documentation is just too concise to get a real picture of how they are 
used (for me, anyway).  Does anybody know of some real examples that I 
could look at, something like a vecotr or linked list sample?  Thanks!

Later,

John
Sep 27 2003
next sibling parent reply "Andrew Edwards" <edwardsac spamfreeusa.com> writes:
JR> "John Reimer" wrote in message news:bl4rb4$2r5n$1 digitaldaemon.com...
JR> I'm studying D templates, and trying to get a feel for them.  But the D
JR> documentation is just too concise to get a real picture of how they are
JR> used (for me, anyway).  Does anybody know of some real examples that I
JR> could look at, something like a vecotr or linked list sample?  Thanks!

Sorry! Don't have an example of vector or linked list. However, here's an
example of a stack.

Hope it helps.

TO COMPILE: dmd teststack stack

Regards,
Andrew
Sep 27 2003
next sibling parent John Reimer <jjreimer telus.net> writes:
 Sorry! Don't have an example of vector or linked list. However, here's an
 example of a stack.
 
 Hope it helps.
 
 TO COMPILE: dmd teststack stack
 
 Regards,
 Andrew
 
 
 
 5 * ( 9 +5 ) - 4
 (4 + 8) * 3 (
 {[8-1)-7}

Oh, that's quite good enough! I just wanted an example of one of the basic data structures, so a stack certainly qualifies. Thank you very much. I'll take a look at that. Later, John
Sep 27 2003
prev sibling parent John Reimer <jjreimer telus.net> writes:
The class in template construction was exactly what I was interested in. 
  So your stuff answered my question well.  Thanks.  I had a vector 
class half-implemented that way, but wasn't sure if I was doing it right 
:-).

Later,

John
Sep 27 2003
prev sibling parent reply Mike Wynn <mike l8night.co.uk> writes:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

John Reimer wrote:
 I'm studying D templates, and trying to get a feel for them.  But the D 
 documentation is just too concise to get a real picture of how they are 
 used (for me, anyway).  Does anybody know of some real examples that I 
 could look at, something like a vecotr or linked list sample?  Thanks!
 
 Later,
 
 John
 

and if you are interested in template param matching here's an example of how to use templates with various params (such as a value to determine calling conventions etc) should still compile, I've been on linux since 0.70 (and this is very win32 specific, last build on 0.69) have you looked at Deimos (check the D links) I belive all the templated classes you are interested in have already been done.
Sep 27 2003
next sibling parent John Reimer <jjreimer telus.net> writes:
 and if you are interested in template param matching
 here's an example of how to use templates with various params (such as a 
 value to determine calling conventions etc)
 should still compile, I've been on linux since 0.70 (and this is very 
 win32 specific, last build on 0.69)

Anything I can get is great! Thanks!
 
 have you looked at Deimos (check the D links) I belive all the templated 
 classes you are interested in have already been done.
 

No, I haven't looked at that. I'll definitely study Deimos too. Later, John
Sep 27 2003
prev sibling parent reply John Reimer <jjreimer telus.net> writes:
Mike Wynn wrote:
 
 have you looked at Deimos (check the D links) I belive all the templated 
 classes you are interested in have already been done.
 

Now that I've had a look, Deimos appears to be in the early stages of development, and doesn't appear to have any of these data structures implemented, but it is a excellent source of D template examples, so that's good. These sources have certainly given me enough to go on :). Later, John
Sep 27 2003
parent "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> writes:
"John Reimer" <jjreimer telus.net> escreveu na mensagem
news:bl5g45$k95$1 digitaldaemon.com...
 Mike Wynn wrote:
 have you looked at Deimos (check the D links) I belive all the templated
 classes you are interested in have already been done.

Now that I've had a look, Deimos appears to be in the early stages of development, and doesn't appear to have any of these data structures implemented, but it is a excellent source of D template examples, so that's good. These sources have certainly given me enough to go on :).

That's truth, Deimos is currently at 0.0.1. I'm struggling to upgrade it to 0.0.2 but unfortunately the compiler don't agree with me sometimes ;) Probably data structures will appear in 0.0.3. 0.0.2 will include some numeric templates, but in 0.0.3 we'll have a pretty large collections module.
 Later,

 John

Best regards, Daniel Yokomiso. "Why aren't you using D by the way? If you like a C-syntax language with design by contract it seems a perfectly good choice. Why turn Eiffel into D when D is already there?" - Franck Arnaud --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 23/9/2003
Sep 28 2003