I don\'t understand why T cannot be deduced in this scenario:
template
class MyType
{
T * data;
};
class MyOtherType
{
};
template
This is because your case is a Non-deduced contexts.
Cited from http://en.cppreference.com/w/cpp/language/template_argument_deduction:
Non-deduced contexts
In the following cases, the types, templates, and non-type values that are used to compose P do not participate in template argument deduction, but instead use the template arguments that were either deduced elsewhere or explicitly specified. If a template parameter is used only in non-deduced contexts and is not explicitly specified, template argument deduction fails.
1) The nested-name-specifier (everything to the left of the scope resolution operator ::) of a type that was specified using a qualified-id
In your case, typename MyType_OutArg<T>::type
will not participate in type deduction, and T
is not known from elsewhere, thus this template function is ignored.