Question 17
Back to Exercise
A function returns std::pair<int, int>. Which line unpacks it into two variables (C++17)?
- A int a, b = f();
- B auto [a, b] = f(); Correct
- C auto (a, b) = f();
- D pair a, b = f();
Correct Answer: Option B
Structured bindings work with pairs, tuples, arrays and structs with public members.
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!