Solution
Here is the solution to the problem in the previous lesson.
Explanation
Add this line to class S
:
void foo(const T&& t) = delete;
foo(T&& t)
only prohibits non-const
rvalues. It allows const
rvalues. By deleting the implementation of foo(const T&& t)
, we make sure that no rvalues are accepted.
Get hands-on with 1300+ tech skills courses.