#pragma once namespace lt::math { template struct vec2_impl { constexpr vec2_impl(): x(), y() { } constexpr explicit vec2_impl(T scalar): x(scalar), y(scalar) { } constexpr vec2_impl(T x, T y): x(x), y(y) { } [[nodiscard]] auto operator==(const vec2_impl &other) const -> bool { return x == other.x && y == other.y; } [[nodiscard]] auto operator!=(const vec2_impl &other) const -> bool { return !(*this == other); } [[nodiscard]] auto operator*(const vec2_impl &other) const -> vec2_impl { return { x * other.x, y * other.y, }; } [[nodiscard]] auto operator-(const vec2_impl &other) const -> vec2_impl { return { x - other.x, y - other.y, }; } [[nodiscard]] auto operator*(float scalar) const -> vec2_impl { return { x * scalar, y * scalar, }; } T x; // NOLINT T y; // NOLINT }; using vec2 = vec2_impl; using ivec2 = vec2_impl; using uvec2 = vec2_impl; } // namespace lt::math template struct std::formatter> { constexpr auto parse(std::format_parse_context &context) { return context.begin(); } auto format(const lt::math::vec2_impl &val, std::format_context &context) const { return std::format_to(context.out(), "{}, {}", val.x, val.y); } };