Consider the simple code (Disclaimer: This is a noobie question) :
template<typename T> struct foo
{
foo(const T&);
foo(T&& ctorArguement):ptrToSomeType(new someType(std::forward<T&&>(ctorArguement))){}
^^
std::unique_ptr<someType> ptrToSomeType;
}
compared to this :
template<typename T> struct foo
{
foo(const T&);
foo(T&& ctorArguement):ptrToSomeType(new someType(std::forward<T>(ctorArguement))){}
^^
std::unique_ptr<someType> ptrToSomeType;
}
I think I should have used std::move but I was wondering particularly about these two cases. So are two version completely equal, or one is better than another?.