vector2d: Fix traits usage and use std::numeric_limits

This commit is contained in:
Marvin Schmidt 2017-11-05 22:03:30 +01:00 committed by Maciej Suminski
parent fc08c58059
commit a6ca44d9f0
1 changed files with 5 additions and 4 deletions

View File

@ -28,7 +28,7 @@
#ifndef VECTOR2D_H_
#define VECTOR2D_H_
#include <climits>
#include <limits>
#include <iostream>
#include <sstream>
@ -54,8 +54,6 @@ template <>
struct VECTOR2_TRAITS<int>
{
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<T>& aVector );
*
*/
template <class T = int>
class VECTOR2 : public VECTOR2_TRAITS<T>
class VECTOR2
{
public:
typedef typename VECTOR2_TRAITS<T>::extended_type extended_type;
typedef T coord_type;
static constexpr extended_type ECOORD_MAX = std::numeric_limits<extended_type>::max();
static constexpr extended_type ECOORD_MIN = std::numeric_limits<extended_type>::min();
T x, y;
// Constructors