From a6ca44d9f078fc67b8159b7338c0e4c18fb93bd5 Mon Sep 17 00:00:00 2001 From: Marvin Schmidt Date: Sun, 5 Nov 2017 22:03:30 +0100 Subject: [PATCH] vector2d: Fix traits usage and use std::numeric_limits --- include/math/vector2d.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/math/vector2d.h b/include/math/vector2d.h index 25e17ca727..d883b9750d 100644 --- a/include/math/vector2d.h +++ b/include/math/vector2d.h @@ -28,7 +28,7 @@ #ifndef VECTOR2D_H_ #define VECTOR2D_H_ -#include +#include #include #include @@ -54,8 +54,6 @@ template <> struct VECTOR2_TRAITS { typedef int64_t extended_type; - static const extended_type ECOORD_MAX = 0x7fffffffffffffffULL; - static const extended_type ECOORD_MIN = 0x8000000000000000ULL; }; // Forward declarations for template friends @@ -73,12 +71,15 @@ std::ostream& operator<<( std::ostream& aStream, const VECTOR2& aVector ); * */ template -class VECTOR2 : public VECTOR2_TRAITS +class VECTOR2 { public: typedef typename VECTOR2_TRAITS::extended_type extended_type; typedef T coord_type; + static constexpr extended_type ECOORD_MAX = std::numeric_limits::max(); + static constexpr extended_type ECOORD_MIN = std::numeric_limits::min(); + T x, y; // Constructors