mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 12:54:25 +02:00
refactor: simplified formatting of latitude
and longitude
This commit is contained in:
@@ -105,7 +105,7 @@ struct STD_FMT::formatter<geographic::latitude> : formatter<geographic::latitude
|
|||||||
template<typename FormatContext>
|
template<typename FormatContext>
|
||||||
auto format(geographic::latitude lat, FormatContext& ctx)
|
auto format(geographic::latitude lat, FormatContext& ctx)
|
||||||
{
|
{
|
||||||
STD_FMT::vformat_to(ctx.out(), lat.value() > 0 ? "N" : "S", {});
|
STD_FMT::format_to(ctx.out(), "{}", lat.value() > 0 ? 'N' : 'S');
|
||||||
return formatter<geographic::latitude::value_type>::format(lat.value() > 0 ? lat.value() : -lat.value(), ctx);
|
return formatter<geographic::latitude::value_type>::format(lat.value() > 0 ? lat.value() : -lat.value(), ctx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -115,7 +115,7 @@ struct STD_FMT::formatter<geographic::longitude> : formatter<geographic::longitu
|
|||||||
template<typename FormatContext>
|
template<typename FormatContext>
|
||||||
auto format(geographic::longitude lon, FormatContext& ctx)
|
auto format(geographic::longitude lon, FormatContext& ctx)
|
||||||
{
|
{
|
||||||
STD_FMT::vformat_to(ctx.out(), lon.value() > 0 ? "E" : "W", {});
|
STD_FMT::format_to(ctx.out(), "{}", lon.value() > 0 ? 'E' : 'W');
|
||||||
return formatter<geographic::longitude::value_type>::format(lon.value() > 0 ? lon.value() : -lon.value(), ctx);
|
return formatter<geographic::longitude::value_type>::format(lon.value() > 0 ? lon.value() : -lon.value(), ctx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user