diff options
Diffstat (limited to 'include/mapbox/geometry/point.hpp')
-rw-r--r-- | include/mapbox/geometry/point.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/mapbox/geometry/point.hpp b/include/mapbox/geometry/point.hpp new file mode 100644 index 0000000..0cba499 --- /dev/null +++ b/include/mapbox/geometry/point.hpp @@ -0,0 +1,35 @@ +#pragma once + +namespace mapbox { +namespace geometry { + +template <typename T> +struct point +{ + using coordinate_type = T; + + constexpr point() + : x(), y() + {} + constexpr point(T x_, T y_) + : x(x_), y(y_) + {} + + T x; + T y; +}; + +template <typename T> +constexpr bool operator==(point<T> const& lhs, point<T> const& rhs) +{ + return lhs.x == rhs.x && lhs.y == rhs.y; +} + +template <typename T> +constexpr bool operator!=(point<T> const& lhs, point<T> const& rhs) +{ + return !(lhs == rhs); +} + +} // namespace geometry +} // namespace mapbox |