A factory uses perfect forwarding to construct an object. What is the bug a senior reviewer should flag here?
template <typename T, typename... Args>
T make(Args&&... args) {
return T(std::forward<Args>(args)...);
}
struct Widget {
Widget(const std::string& s);
};
std::string name = "hi";
auto w = make<Widget>(std::move(name));
// 'name' is read again later