summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-08-25 10:42:14 -0700
committerChris Loer <chris.loer@mapbox.com>2017-08-25 14:20:42 -0700
commit17a3a805f129670ff63967bfca4d46e66bfe619f (patch)
tree221ead31fad68433f41b645cc245abc68f59c37f
parentfe8cbc78d3b01004ba672fe4836cc252ffd52605 (diff)
downloadqtlocation-mapboxgl-17a3a805f129670ff63967bfca4d46e66bfe619f.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;
}