O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Templates

The goal here is to help you understand the mechanisms behind the STL. Templates are a complex subject, and it is only through using them and reading through other people’s code that you’ll fully begin to appreciate exactly how powerful they are.

This section doesn’t provide a real grounding in using templates as such, it just covers the way that they can be leveraged through the STL. However, you’ll be able to appreciate their use, deploy them, and learn more about them from reading the STL header files.

Templates are good because they allow you to create generic versions of the following:

  • Functions

  • Classes

The same code is written once, and once only, and can then be reused with other data types. For example, if you have a comparison ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required