diff options
author | Lioncash <mathew1800@gmail.com> | 2019-05-29 02:47:01 -0400 |
---|---|---|
committer | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2019-05-31 04:44:02 -0300 |
commit | 1edf018319a7ca7fcc88406f1fd73e180b7c0b63 (patch) | |
tree | f9e110a03f3ce287cd7c9a5a6a7eb07948fd2f72 /src/common/math_util.h | |
parent | ed74a3cb8b69841bd34344b1387320c0d8912979 (diff) |
common/math_util: Provide a template deduction guide for Common::Rectangle
Allows for things such as:
auto rect = Common::Rectangle{0, 0, 0, 0};
as opposed to being required to explicitly write out the underlying
type, such as:
auto rect = Common::Rectangle<int>{0, 0, 0, 0};
The only requirement for the deduction is that all constructor arguments
be the same type.
Diffstat (limited to 'src/common/math_util.h')
-rw-r--r-- | src/common/math_util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/math_util.h b/src/common/math_util.h index cff3d48c5c..d6c35ee899 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -41,4 +41,7 @@ struct Rectangle { } }; +template <typename T> +Rectangle(T, T, T, T)->Rectangle<T>; + } // namespace Common |