Question 18
Back to Exercise
In template <typename T> void f(T&& x), what kind of reference is x?
- A Always an rvalue reference
- B A forwarding (universal) reference: it binds to lvalues and rvalues, and std::forward<T>(x) preserves which one it was Correct
- C A const reference
- D A pointer
Correct Answer: Option B
Reference collapsing makes T&& become an lvalue reference when an lvalue is passed.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!