diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-03-22 21:49:35 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-03-22 23:51:00 +0100 |
| commit | 2fca6ad9716429660e7162807582db00c3ca6865 (patch) | |
| tree | 37bc7a343a6d72b19311ebe7dbb4f07c185491dc /src/types.cc | |
| parent | 5ddb909ac7033d4becffa39dadbb14b8ab4ca0ab (diff) | |
Add operator< for Fraction.
Diffstat (limited to 'src/types.cc')
| -rw-r--r-- | src/types.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/types.cc b/src/types.cc index bbb66e3a..3b79be2a 100644 --- a/src/types.cc +++ b/src/types.cc @@ -110,6 +110,15 @@ dcp::operator!= (Fraction const & a, Fraction const & b) } +bool +dcp::operator< (Fraction const& a, Fraction const& b) +{ + DCP_ASSERT(a.denominator > 0); + DCP_ASSERT(b.denominator > 0); + return a.numerator * b.denominator < b.numerator * a.denominator; +} + + Colour::Colour (int r_, int g_, int b_) : r (r_) , g (g_) |
