Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Zolotarev <deathbaba@gmail.com>2011-01-19 02:55:36 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:10:34 +0300
commit9473e1fa1e18c8abef9a3a43b15aa8dca62cdde1 (patch)
tree092efa3401e3e85ff758973936c1039477a15927 /geometry
parent6cc2831c2d4211822bb9787f3dca6d9a0b786a01 (diff)
Added static assert in distance for unsigned point types
Diffstat (limited to 'geometry')
-rw-r--r--geometry/distance.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/geometry/distance.hpp b/geometry/distance.hpp
index de22bece4a..28b9aa7147 100644
--- a/geometry/distance.hpp
+++ b/geometry/distance.hpp
@@ -1,12 +1,19 @@
#pragma once
+
#include "../base/base.hpp"
+#include <boost/type_traits/is_unsigned.hpp>
+
// Similarly to namespace m2 - 2d math, this is a namespace for nd math.
namespace mn
{
template <typename PointT> class DistanceToLineSquare
{
+private:
+ // we do not support unsigned points!!!
+ STATIC_ASSERT(std::numeric_limits<typename PointT::value_type>::is_signed);
+
public:
DistanceToLineSquare(PointT p0, PointT p1)
: m_P0(p0), m_P1(p1), m_D(m_P1 - m_P0), m_D2(DotProduct(m_D, m_D)), m_InvD2(1.0 / m_D2)