rpgxef/code/common/Point2d.h
Walter Julius Hennecke 1d7f1ff271 fixed all compile errors
2019-02-23 11:24:56 +01:00

23 lines
487 B
C++

#pragma once
#include <cstdint>
#include <type_traits>
namespace common {
template<typename T>
class Point2d {
public:
template<typename A, typename B, typename = std::enable_if_t<std::is_convertible_v<A, T> && std::is_convertible_v<B, T>>>
constexpr Point2d(A _x = 0, B _y = 0) : x{T{_x}}, y{T{_y}} {}
T x;
T y;
};
using Point2dI = Point2d<int32_t>;
using Point2dF = Point2d<float>;
using Point2dD = Point2d<double>;
}