Given the following typical definition of swap § 13.3 (p. 517), determine which version of swap is used if mem1 is a string. What if mem1 is an int? Explain how name lookup works in both cases.
void swap(T v1, T v2){ using std::swap; swap(v1.mem1, v2.mem1); // swap remaining members of type T}§ 13.3 (p. 517)
Exercise 29
Explain why the calls to swap inside swap(HasPtr&, HasPtr&) do not cause a recursion loop.
Exercise 30
Write and test a swap function for your valuelike version of HasPtr. Give your swap a print statement that notes when it is executed.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.