In function call, why doesn't nullptr match a pointer to a template object?
Here is an example of a code that works perfectly: #include<iostream> #include<vector> template< class D, template< class D, class A > class C, class A = std::allocator< D > > void foo( C< D, A > *bar, C< D, A > *bas ) { std::cout << "Ok!" << std::endl; } int main( ) { std::vector< int > *sample1 = nullptr; std::vector< int > *sample2 = nullptr; foo( sample1, sample2 ); return( 0 ); } In the code below, however, the compiler is unable to match std::vector< int >* with nullptr for the second parameter, even being able to deduct the template types from the first parameter. #include<iostream>