🔒 Locked
Templates Tutorials
Advertisement
Original Post
I'm looking for a good tutorial on the use of templates; as of right now I've been using them for some very basic pattern implementions and nothing else. Internet tutorials (free ones!) would definately be great, but as would books. I know I saw a book somewhere on here that seemed like it would be good, but I want to know everyone else's opinion on the matter. Its one of my weak areas; I want to strengthen myself up!
Thanks a lot man, I'll definately be looking into buying those books. I think I need something to spice up my programming, its been lacking ever since these beginner's introduction classes I'm taking at community college. I think I'm going to die learning how to "properly use an if statement."
Halfway through the semester and we haven't even touched loops yet. Ugh.
Halfway through the semester and we haven't even touched loops yet. Ugh.
Not sure if it goes into enough detail for you, but Thinking in C++ has a chapter on templates. It's free to download, just do a search.
Angelika Langer's website has lots of good articles including this one on Expression Templates.
Also Todd Veldhuizen's Template Metaprograms and ExpressionTemplates.
Also this article about using the boost metaprogramming library to create a dimensional analysis library for checking, at compile time, to make sure that for example, a variable representing acceleration really is made up of a distance variable divided twice by time variables.
Also Todd Veldhuizen's Template Metaprograms and ExpressionTemplates.
Also this article about using the boost metaprogramming library to create a dimensional analysis library for checking, at compile time, to make sure that for example, a variable representing acceleration really is made up of a distance variable divided twice by time variables.
Quote:
Original post by antareus
Modern C++ Design - *the* book on generic programming...truly revolutionary
C++ Templates - the nitty-gritty details of the template system
Imperfect C++ - useful applications of templates
As for Internet tutorials, I don't know of many.
See sample chapters for MC++D Ch 1: Policy based design Ch 7: Smart pointers
C++ Templates sample chapters
Quote:That comes from Abrahams' and Gurtovoy's "C++ Template Metaprogramming" (aka "The MPL Book"), which is an excellent book I can't recommend enough. I suggest reading "Modern C++ Design" first to get an idea of what the MPL book is all about, which is formalizing the ideas presented in "Modern C++ Design".
Original post by petewood
Also this article about using the boost metaprogramming library to create a dimensional analysis library for checking, at compile time, to make sure that for example, a variable representing acceleration really is made up of a distance variable divided twice by time variables.
Quote:Especially Spirit. Spirit is the holy grail of template metaprogramming.
Original post by nuvem
Another great way to learn is to take apart a random boost library and figure out how it works. It will blow your mind.
However, I find that much of boost is obscured the preprocessor code (cf. the Boost.Preprocessor library) that is required to overcome limitations of the template engine. Learning the PP library is pretty much a prereq to understanding boost code.
The combined power of Boost.MPL and Boost.PP is nothing short of amazing (although I'm sure Lispies are laughing at us...)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement