Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Endemoniada

wtf is a template ?

This topic is 5454 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, For years I''ve been programming in C(++) for Windows; I can program excellent stand-alone Windows applications as well as games using DirectX. I''ve programmed Windows apps for viewing fractals and Perlin noise functions, I even made a program that makes thumbnail galleries with nothing more than the big images as input (it makes the thumbs and writes the HTML code, all in C++) And I still don''t know what a template is. Are they part of "managed code" ? wtf is "managed code" anyway ? Do I really need to learn this stuff ? Any input is appreciated. Thanks, Endo

Share this post


Link to post
Share on other sites
Advertisement
A template is part of C++. Here''s a tutorial on templates. http://www.cplusplus.com/doc/tutorial/tut5-1.html . I don''t know what managed code is though.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The simple answer is that for years you have not been programming in C++, you have been programming in "MicroSoft C with Classes".

Share this post


Link to post
Share on other sites
google with template...

This is only an 'immediate' example



template<class T>
void Swap(T& A, T& B)
{
T tmp(A);
A = B;
B = tmp;
}



later you can write


int ia,ib;
Swap(ia,ib);

string sa,sb;
Swap(sa,sb);



[edited by - blizzard999 on November 8, 2003 6:10:54 PM]

Share this post


Link to post
Share on other sites
God I hate when people use ''wtf.'' It makes them look very imature. Managed code is microsoft''s replacement for the win32 api (soon to be replaced with that longhorn thing...), and no, templates are not part of managed code. They aren''t particularly useful in everyday code, but they''re really helpful when making libraries (not to mention metaprogramming). Now that I think about it, you could''ve easily found out what a template is with google *hint hint*.

Share this post


Link to post
Share on other sites
Managed code is what the .NET framework uses. So it''s tied to that, it is safer, and managed direct x is 3-5% slower than unmanaged according to ms, and only beginning with longhorn will windows be built on a native managed code environment. It will also be backwards compatible, so you don''t need to learn it for many a years if you don''t want to. It''s way easier though with garbage collecting, a tenth the amount of arguments passed (at least it feels like that) and the general neatness of C#.

/Apoztel

Share this post


Link to post
Share on other sites
quote:
Original post by brassfish89
They aren''t particularly useful in everyday code, but they''re really helpful when making libraries (not to mention metaprogramming).


Depends what you are doing, if you are making heavy use of the STL & boost librarys then the useage of templates is very usefull

Share this post


Link to post
Share on other sites
Templates are a rare sort of addition to the language in that their existence changes everything pretty much. You can''t even get your mind around how much you can do with them, but they are an absolute pain at times when you have the syntax off a little.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!