Talk:cpp/utility/forward
From cppreference.com
Is this page right?????
- Can you be a bit more specific? Nate 17:29, 20 February 2012 (PST)
I think the line which mentions std::forward is actually calling the copy constructors of struct A - not the two constructor that are actually shown.
As we have not provided any copy constructors, then the compiler provided ones will be used - so we are not actually seeing how std::forward works.
the two output lines we see on the screen are dues to these two lines:
std::unique_ptr<A> p1 = make_unique<A>(2); // rvalue int i = 1; std::unique_ptr<A> p2 = make_unique<A>(i); // lvalue
which are using the two constructors as conversion constructors (converting from int to class A object)
(Sorry for any bad formatting - don't know to use this wiki stuff)