File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88#include " ffmpeg.h"
99#include " avutils.h"
1010
11- #ifdef AVCPP_USE_SPACESHIP_OPERATOR
11+ #if AVCPP_USE_SPACESHIP_OPERATOR
1212# include < compare>
1313#endif
1414
@@ -51,18 +51,16 @@ class Rational
5151 Rational& operator = (double value) noexcept ;
5252
5353 bool operator == (const Rational &other) const noexcept ;
54- #ifdef AVCPP_USE_SPACESHIP_OPERATOR
54+ #if AVCPP_USE_SPACESHIP_OPERATOR
5555 std::strong_ordering operator <=>(const Rational &other) const noexcept
5656 {
57- switch (threewaycmp (other)) {
58- case -1 :
59- return std::strong_ordering::less;
60- case 0 :
57+ if (auto const cmp = threewaycmp (other); cmp == 0 ) {
6158 return std::strong_ordering::equal;
62- case 1 :
59+ } else if (cmp < 0 ) {
60+ return std::strong_ordering::less;
61+ } else {
6362 return std::strong_ordering::greater;
6463 }
65- return std::strong_ordering::equal; // make a compiler happy
6664 }
6765#else
6866 bool operator != (const Rational &other) const noexcept {
You can’t perform that action at this time.
0 commit comments