Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++perfect forwarding std::forwardSingle-choice MCQ

A factory uses `std::forward` to perfectly forward to a constructor. What subtle problem does this exhibit when the same forwarding reference is used more than once?

template <typename T, typename Arg> std::pair<T, T> make_two(Arg&& a) { return { T(std::forward<Arg>(a)), T(std::forward<Arg>(a)) }; }