Home arrow C++ arrow Templates in C++

Templates in C++

Templates have been helping programmers to change the way they are able to code since the ealy 1990s. Since that time they have advanced rapidly, and in this tutorial we will take a close look at them and learn to use them to effectively decrease our tasks.

Author Info:
By: Gabor Bernat
Rating: 3 stars3 stars3 stars3 stars3 stars / 9
June 17, 2008
  1. · Templates in C++
  2. · Starting with Templates
  3. · Class Templates
  4. · Template Specialization

print this article

Templates in C++
(Page 1 of 4 )

Templates, as a programming concept, redefined the way we are able to code nowadays. Templates appeared back in the early 1990s and soon after, they started to advance rapidly. For this reason, the legendary author Scott Meyers decided to skip over templates; thus, they aren’t covered in the book, “Effective C++.”

Later in 1995, despite the fact that he wrote a chapter on templates, the author decided not  to include  it in the published edition of the book, More Effective C++, since he thought that this area was still experiencing growth and evolution.

He was quite right. This so-called evolution lead to the rise of one of the most crucial items for a C++ programmer in the 21st century: the template libraries. Here we can include one of the best known libraries, the STL (Standard Template Library), which is also included in Visual Studio's STD.

But there exist many others that are just as important; for example, the boost library or the Loki library of Andrei Alexandrescu. All of these rely on templates and you must be very familiar with them if you plan to become a good, efficient, and fast C++ programmer.

I want to congratulate you for investing your time in something that I can promise you won't regret. This article will teach you all that you need to know about templates. It can be considered a prequel to the STL library introduction article.

We're going to begin with function templates, followed by class templates, and conclude with template specialization or non-type parameters for templates. All of this will be covered, so prepare yourself for more knowledge and let's begin!

blog comments powered by Disqus

- Intel Threading Building Blocks
- Threading Building Blocks with C++
- Video Memory Programming in Text Mode
- More Tricks to Gain Speed in Programming Con...
- Easy and Efficient Programming for Contests
- Preparing For Programming Contests
- Programming Contests: Why Bother?
- Polymorphism in C++
- Overview of Virtual Functions
- Inheritance in C++
- Extending the Basic Streams in C++
- Using Stringstreams in C++
- Custom Stream Manipulation in C++
- General Stream Manipulation in C++
- Serialize Your Class into Streams in C++

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials