Non-type Template Parameters
Get introduced to non-type template parameters.
We'll cover the following...
C++ supports non-types as template parameters. Essentially non-types could be:
- integers and enumerators
- pointers or references to objects, to functions, and to attributes of a class
std::nullptr_t
🔑 Typical non-type template parameter
When I ask the students in my class if they ever used a non-type as template parameter they say: No! Of course, I answer my tricky question and show an often-used example for non-type template parameters:
std::array<int, 5> myVec;
Constant ...