Question 12
Back to Exercise
A C++20 class declares auto operator<=>(const T&) const = default;. Which operators can now be used?
- A Only <=>
- B <, <=, > and >= (and == too, since a defaulted <=> also declares a defaulted ==) Correct
- C Only == and !=
- D None without more code
Correct Answer: Option B
Relational operators are rewritten to use <=>; a defaulted <=> also implicitly declares a defaulted ==.
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!