Skip to main content

Chapter 9: Templates

  • Chapter
C++ Recipes
  • 5099 Accesses

Abstract

The STL is written used a language feature provided by C++ called templates. Templates provide a method you can use to write generic code that can be specialized at compile time to create concrete functions and classes of varying type. The only requirement for template code is that output can be generated for all of the types used to specialize a template in your program. This may be a little difficult to understand at this point, but it should be clearer by the time you finish this chapter.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Bruce Sutherland

About this chapter

Cite this chapter

Sutherland, B. (2015). Chapter 9: Templates. In: C++ Recipes. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0157-2_9

Download citation

Publish with us

Policies and ethics