I have a class
like this:
class Widget
{
public:
Widget(A const& a) { /* do something */ }
Widget(A&& a) { /* do something */ }
};
Which I can use like this:
A a{};
Widget widget{a};
If I came to the conclusion that I don't need a
any longer, I could call:
Widget{std::move(a)};
But now what if I needed an A
object only for the construction of widget
? Would I do this:
Widget widget{A{}};
or
Widget widget{std::move(A{})};