In the following code:
Widget makeWidget()
{
return Widget();
}
void foo(Widget widget)
{
...
}
foo(makeWidget());
the Widget object will be always constructed in-place (inside foo function), so no move construction takes place (at least with all compilers I've tried). What are simple examples of passing a temporary to a function by value in a way that move construction will actually take place (without explicitly moving, i.e. using std::move)?