Talk:cpp/utility/forward

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 p1 = make_unique(2); // rvalue int i = 1; std::unique_ptr p2 = make_unique(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)


 * Actually, yes, you're totally right. It's not demonstrating forwarding. Feel free to post a better example if you have one in mind. --Cubbi 14:35, 21 February 2012 (PST)
 * Meanwhile, I modified the example to use std::forward meaningfully. --Cubbi 17:50, 21 February 2012 (PST)