Add util::fixed_point formatter
This commit is contained in:
parent
abec5474f0
commit
99063348e3
1 changed files with 19 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstdint>
|
||||
#include <concepts>
|
||||
#include <limits>
|
||||
#include <format>
|
||||
|
||||
namespace psemek::util
|
||||
{
|
||||
|
|
@ -455,3 +456,21 @@ namespace psemek::util
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <unsigned int I, unsigned int F, bool S, typename Char>
|
||||
struct formatter<::psemek::util::fixed_point<I, F, S>, Char>
|
||||
: formatter<double>
|
||||
{
|
||||
using base = formatter<double>;
|
||||
|
||||
template <typename FormatContext>
|
||||
auto format(::psemek::util::fixed_point<I, F, S> const & fp, FormatContext & ctx) const
|
||||
{
|
||||
return base::format(static_cast<double>(fp), ctx);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue