The code is as follows:
template <class InputIterator, class OutputIterator>
inline OutputIterator copy(InputIterator first, InputIterator last,
OutputIterator result)
{
return __copy_dispatch<InputIterator,OutputIterator>()(first, last, result);
}
//A overload version
inline char* copy(const char* first, const char* last, char* result) {
memmove(result, first, last - first);
return result + (last - first);
}
If I call copy(int*, int*)
, which is the best match, will the compiler instantiate a new function use int*
as the template parameter, or int*
will be convert to char*
.
And what if I call copy(char[], char[])
notice I just use char[]
to note the type of parameters.