_index

Table of Contents

Chapter 1 Deducing Types

Item 1: Understand template type deduction

Imagine this:

template<typename T>
void f(ParamType param);

The type ParamType and the typename T may be the same or different.

In the case below, T is deduced to be int, but ParamType is const int&.

template<typename T>
void f(const T& param);

int x = 0;
f(x);

There are 3 cases