Skip to content
dabrahams edited this page Aug 6, 2012 · 6 revisions

Overloading Function Templates

1. Write a function template Copy that takes two pointers p and q of the same type and a std::size_t n, and copies n adjacent elements starting at p into the array starting at q

2. Overload Copy with a function that copies ints by using std::memcpy

3. Overload Copy with a function template that copies an array of any pointer type using std::memcpy

4. Verify that the “right” function is called automatically

Solution