summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-08-25 10:42:14 -0700
committerChris Loer <chris.loer@gmail.com>2017-08-25 10:42:14 -0700
commite79162fa79f25d62aaf46e992fac6dc2cc7714db (patch)
tree3fe5b00a37a9805c1ea1af0ece233c3ca3f82472
parentb0c03f9396f52264184f9a0b18efdf89e787799d (diff)
downloadqtlocation-mapboxgl-e79162fa79f25d62aaf46e992fac6dc2cc7714db.tar.gz
[core] Add optional type template parameter to util::unit, so that it doesn't always pick up the default type of 'double' from util::mag.
-rw-r--r--src/mbgl/util/math.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mbgl/util/math.hpp b/src/mbgl/util/math.hpp
index fcde01c1a3..c18ce0c254 100644
--- a/src/mbgl/util/math.hpp
+++ b/src/mbgl/util/math.hpp
@@ -77,9 +77,9 @@ T mag(const S& a) {
return std::sqrt(a.x * a.x + a.y * a.y);
}
-template <typename S>
+template <typename T = double, typename S>
S unit(const S& a) {
- auto magnitude = mag(a);
+ auto magnitude = mag<T>(a);
if (magnitude == 0) {
return a;
}