I've just started looking into move semantics and Rvalue references so I am learning as I go along, I was wondering whether a call to std::forward is needed when passing an Rvalue function parameter into a smart pointer?
void CreateUniquePtr(int&& value) { std::unique_ptr<int> ptr = std::make_unique<int>(std::forward<int>(value)); } vs
void CreateUniquePtr(int&& value) { std::unique_ptr<int> ptr = std::make_unique<int>(value); }
valueis not an Rvalue, and is, confusingly, an lvalue. stackoverflow.com/questions/14486367/…std::forwardoutside of template cases. Using in any non-template case is pointless and possibly wrong.