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

Given this forwarding wrapper, what does the call print?

#include <iostream> #include <utility> void sink(int& x) { std::cout << "lvalue\n"; } void sink(int&& x) { std::cout << "rvalue\n"; } template <typename T> void relay(T&& arg) { sink(arg); // line A sink(std::forward<T>(arg)); // line B } int main() { relay(42); }