From: Carl Hetherington Date: Tue, 8 Aug 2023 16:21:24 +0000 (+0200) Subject: Cleanup: make some default constructors more consistent. X-Git-Tag: v1.8.75 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=ae92f24aef30140e85a44bb179a55af02b33eb3c;p=libdcp.git Cleanup: make some default constructors more consistent. --- diff --git a/src/types.cc b/src/types.cc index 9b868197..e2e72ad1 100644 --- a/src/types.cc +++ b/src/types.cc @@ -109,12 +109,6 @@ dcp::operator!= (Fraction const & a, Fraction const & b) } -Colour::Colour () -{ - -} - - Colour::Colour (int r_, int g_, int b_) : r (r_) , g (g_) diff --git a/src/types.h b/src/types.h index 340d8613..f6e996c7 100644 --- a/src/types.h +++ b/src/types.h @@ -69,10 +69,7 @@ namespace dcp */ struct Size { - Size () - : width (0) - , height (0) - {} + Size() = default; Size (int w, int h) : width (w) @@ -83,8 +80,8 @@ struct Size return float (width) / height; } - int width; - int height; + int width = 0; + int height = 0; }; @@ -206,7 +203,8 @@ class Fraction { public: /** Construct a fraction of 0/0 */ - Fraction () {} + Fraction() = default; + explicit Fraction (std::string s); /** Construct a fraction with a specified numerator and denominator. * @param n Numerator. @@ -261,7 +259,7 @@ class Colour { public: /** Construct a Colour, initialising it to black */ - Colour (); + Colour() = default; /** Construct a Colour from R, G and B. The values run between * 0 and 255.