Wednesday, June 22, 2005

Your quote goes here!

Imagine my state of mind when i understood what B. Stroustrup meant with this quote at the beginning of his chapter on templates in the TCPL. I could not believe it!!! Those 4 words just meant what the whole chapter was to unveil. If you understand these 4 words, you understand templates!!! :) I have this habit of going off to my friends and talking about this. I am sure they
are smiling when they read this!

Just think of the amount of thinking that has gone into making this book. Awesome.

For those who do not understand what i write, here goes:
Templates (in C++) are a way to generate your own types at run-time.

In the non-Templates world:
Say, if you wrote a stack class and bound it to int type. Now, suddenly you realize that you need the same for string type, what you do is to use the same code for int stack, and just change the type to string.

Welcome to the Templates world:
To prevent code replication (by you!), you just write a template and pass your type parameter to it and voila, you have a new type ready in a jiffy. so...

Your type goes here!!!
-templates.

-ramanarpanamastu

2 Comments:

Blogger raghav said...

Thank You! Ram. You know how my blog sounds right? Boring probably, but these are the things i like to write about. So, more tech stuff/corporate stuff will show up. All in time :)
Jai Jai Hanuman, Jai Shri Ram

4:44 AM  
Blogger Techie said...

I still remember that you had asked me too. :)

Good start with a great quote.
-- Malatesh

8:02 PM  

Post a Comment

<< Home