From 83ba339eb52c6ebdb2991f7139e764217ebd0ae2 Mon Sep 17 00:00:00 2001 From: Orange Date: Thu, 25 Sep 2025 21:57:05 +0300 Subject: [PATCH] fix --- include/omath/angle.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/omath/angle.hpp b/include/omath/angle.hpp index 1f9d820..993ddae 100644 --- a/include/omath/angle.hpp +++ b/include/omath/angle.hpp @@ -162,6 +162,7 @@ struct std::formatter, char> // NOLINT(*-dcl58-cp } template + [[nodiscard]] auto format(const AngleT& a, FormatContext& ctx) const { static_assert(std::is_same_v); @@ -181,9 +182,30 @@ struct std::formatter, wchar_t> // NOLINT(*-dcl58 } template + [[nodiscard]] auto format(const AngleT& a, FormatContext& ctx) const { static_assert(std::is_same_v); return std::format_to(ctx.out(), L"{}deg", a.as_degrees()); } }; + +// wchar_t formatter +template +struct std::formatter, char8_t> // NOLINT(*-dcl58-cpp) +{ + using AngleT = omath::Angle; + + static constexpr auto parse(std::wformat_parse_context& ctx) + { + return ctx.begin(); + } + + template + [[nodiscard]] + auto format(const AngleT& a, FormatContext& ctx) const + { + static_assert(std::is_same_v); + return std::format_to(ctx.out(), u8"{}deg", a.as_degrees()); + } +};