It is my understanding that if you use T&& and std::forward<T> with templates, you create perfect forwarding, in that you can pass both lvalues and rvalues to a single function without overloads or conversions. For a large project I've been doing, I designed the following class and I've written the following code to test it. Why doesn't it work in 3 of the 5 cases?
Thank you, that works perfectly, and all 5 types now work. Why is it that that works?
EDIT: I actually googled it rather than just asking. Is it because I specified the template in the class as an std::string, but if it was deduced in the function call, it would have been either std::string& or std::string&&, both of which are handled by reference collapsing?