summaryrefslogtreecommitdiff
path: root/src/lib/rect.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-08 21:32:44 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-08 21:32:44 +0200
commit3339d3bce70afe9ae2ca10e9fcfc4b54b748fbf4 (patch)
tree9cac355432ba25cc3d43017382d73e0640f50996 /src/lib/rect.h
parent00762c2d9a4240d016150cd7555aee3dad8542ae (diff)
Assorted C++11/formatting cleanups.
Diffstat (limited to 'src/lib/rect.h')
-rw-r--r--src/lib/rect.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/rect.h b/src/lib/rect.h
index 4851ad007..5f807f499 100644
--- a/src/lib/rect.h
+++ b/src/lib/rect.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,18 +18,22 @@
*/
+
#ifndef DCPOMATIC_RECT_H
#define DCPOMATIC_RECT_H
+
#include "position.h"
#include <boost/optional.hpp>
#include <algorithm>
+
/* Put this inside a namespace as Apple put a Rect in the global namespace */
namespace dcpomatic
{
+
/** @struct Rect
* @brief A rectangle.
*/
@@ -69,7 +73,7 @@ public:
return Position<T> (x, y);
}
- boost::optional<Rect<T> > intersection (Rect<T> const & other) const
+ boost::optional<Rect<T>> intersection (Rect<T> const & other) const
{
/* This isn't exactly the paragon of mathematical precision */
@@ -83,7 +87,7 @@ public:
);
if (r.width < 0 || r.height < 0) {
- return boost::optional<Rect<T> > ();
+ return {};
}
return r;
@@ -114,6 +118,8 @@ public:
}
};
+
}
+
#endif