That is a non-deducible context. The template parameter T
cannot be deduced.
Here is a simplest example. Given:
template<typename T>
struct X
{
X(T t) : data(t) {}
T data;
};
template<typename T>
void f(X<T> param);
Now you're doing something like this:
f(100);
thinking that T
will be deduced to int
. NO. It will not be deduced to int
. Because there could be more than one possibility for T
. For example, there might be specializations as:
template<>
struct X<double>
{
X(int t) : data(t) {}
int data;
};
template<>
struct X<float> //another specialization
{
X(int t) : data(t) {}
int data;
};
So even though t
is int
(same as the type of 100
), the template argument could be double
or float
(or any other type).