mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-14 15:33:26 +00:00
fix
This commit is contained in:
@@ -162,6 +162,7 @@ struct std::formatter<omath::Angle<T, MinV, MaxV, F>, char> // NOLINT(*-dcl58-cp
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class FormatContext>
|
template<class FormatContext>
|
||||||
|
[[nodiscard]]
|
||||||
auto format(const AngleT& a, FormatContext& ctx) const
|
auto format(const AngleT& a, FormatContext& ctx) const
|
||||||
{
|
{
|
||||||
static_assert(std::is_same_v<typename FormatContext::char_type, char>);
|
static_assert(std::is_same_v<typename FormatContext::char_type, char>);
|
||||||
@@ -181,9 +182,30 @@ struct std::formatter<omath::Angle<T, MinV, MaxV, F>, wchar_t> // NOLINT(*-dcl58
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class FormatContext>
|
template<class FormatContext>
|
||||||
|
[[nodiscard]]
|
||||||
auto format(const AngleT& a, FormatContext& ctx) const
|
auto format(const AngleT& a, FormatContext& ctx) const
|
||||||
{
|
{
|
||||||
static_assert(std::is_same_v<typename FormatContext::char_type, wchar_t>);
|
static_assert(std::is_same_v<typename FormatContext::char_type, wchar_t>);
|
||||||
return std::format_to(ctx.out(), L"{}deg", a.as_degrees());
|
return std::format_to(ctx.out(), L"{}deg", a.as_degrees());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// wchar_t formatter
|
||||||
|
template<class T, T MinV, T MaxV, omath::AngleFlags F>
|
||||||
|
struct std::formatter<omath::Angle<T, MinV, MaxV, F>, char8_t> // NOLINT(*-dcl58-cpp)
|
||||||
|
{
|
||||||
|
using AngleT = omath::Angle<T, MinV, MaxV, F>;
|
||||||
|
|
||||||
|
static constexpr auto parse(std::wformat_parse_context& ctx)
|
||||||
|
{
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class FormatContext>
|
||||||
|
[[nodiscard]]
|
||||||
|
auto format(const AngleT& a, FormatContext& ctx) const
|
||||||
|
{
|
||||||
|
static_assert(std::is_same_v<typename FormatContext::char_type, char8_t>);
|
||||||
|
return std::format_to(ctx.out(), u8"{}deg", a.as_degrees());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user