Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Expert C++ - Second Edition

You're reading from  Expert C++ - Second Edition

Product type Book
Published in Aug 2023
Publisher Packt
ISBN-13 9781804617830
Pages 604 pages
Edition 2nd Edition
Languages
Authors (5):
Marcelo Guerra Hahn Marcelo Guerra Hahn
Profile icon Marcelo Guerra Hahn
Araks Tigranyan Araks Tigranyan
Profile icon Araks Tigranyan
John Asatryan John Asatryan
Profile icon John Asatryan
Vardan Grigoryan Vardan Grigoryan
Profile icon Vardan Grigoryan
Shunguang Wu Shunguang Wu
Profile icon Shunguang Wu
View More author details

Table of Contents (24) Chapters

Preface Part 1:Under the Hood of C++ Programming
Chapter 1: Building C++ Applications Chapter 2: Beyond Object-Oriented Programming Chapter 3: Understanding and Designing Templates Chapter 4: Template Meta Programming Chapter 5: Memory Management and Smart Pointers Part 2: Designing Robust and Efficient Applications
Chapter 6: Digging into Data Structures and Algorithms in STL Chapter 7: Advanced Data Structures Chapter 8: Functional Programming Chapter 9: Concurrency and Multithreading Chapter 10: Designing Concurrent Data Structures Chapter 11: Designing World-Ready Applications Chapter 12: Incorporating Design Patterns in C++ Applications Chapter 13: Networking and Security Chapter 14: Debugging and Testing Chapter 15: Large-Scale Application Design Part 3:C++ in the AI World
Chapter 16: Understanding and Using C++ in Machine Learning Tasks Chapter 17: Using C++ in Data Science Chapter 18: Designing and Implementing a Data Analysis Framework Index Other Books You May Enjoy

Exploring template parameters and arguments

We learned about function and class templates and their instantiations in the previous three sections. We know that, when defining a template, its parameter list needs to be given. While we instantiate it, the corresponding argument list must be provided. In this section, we will further study the classifications and details of these two lists.

Template parameters

Recall the following syntax, which is used to define a class/function template. There is a <> symbol after the template keyword, in which one or more template parameters must be given:

//class template declarationtemplate <parameter-list> class-declaration
//function template declaration
template <parameter-list> function-declaration

A parameter inside the parameter list could be one of the following three types:

  • Non-type template parameter: Refers to the compile-time constant values, such as integers and pointers, that reference static entities...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}