Why does this code not work:
template <typename valueType>
struct ts
{
inline ts( valueType v )
{}
};
template <typename charType>
inline void test( ts <charType> str )
{}
void testfun( void )
{
test( 1 ); // ERROR: ts <typename valueType> not deducible from int
}
But this one does?
void testfun( void )
{
ts a = 1; // OK: ts <typename valueType> is ts <int> because constructor
}
In both cases we are dealing with a ts-template but in the first case it is an embedded template instantiation as function parameter and in the second case the template is directly deduced. Please elaborate using arguments of the C++20 standard.