I have following template function which has template template parameter as its argument.
template<typename T,
template <typename... ELEM> class CONTAINER = std::vector>
void merge(typename CONTAINER<T>::iterator it )
{
std::cout << *it << std::endl;
}
And the following code uses this code.
std::vector<int> vector1{1,2,3};
merge<int>(begin(vector1));
It works as expected, but when I use
merge(begin(vector1));
It cannot deduce type of T
.
I thought that it could deduce type from std::vector<int>::iterator it;
as int
.
Why the compiler can't deduce the type?