@@ -184,18 +184,7 @@ template <isQuantity Q, typename quotient> using Rooted = Named<
184184 std::ratio_divide<typename Q::angle, quotient>, std::ratio_divide<typename Q::temperature, quotient>,
185185 std::ratio_divide<typename Q::luminosity, quotient>, std::ratio_divide<typename Q::moles, quotient>>>;
186186
187- template <isQuantity Q>
188- requires (!std::is_same_v<Named<Q>, Q>)
189- struct std::formatter<Q> : std::formatter<double> {
190- auto format (const Q& quantity, std::format_context& ctx) const {
191- // return std::format_to(ctx.out(), "{}", quantity.internal());
192- return std::formatter<Named<Q>>::format (quantity, ctx);
193- }
194- };
195-
196- template <isQuantity Q>
197- requires std::is_same_v<Named<Q>, Q>
198- struct std ::formatter<Q> : std::formatter<double > {
187+ template <isQuantity Q> struct std ::formatter<Q> : std::formatter<double > {
199188 auto format (const Q& quantity, std::format_context& ctx) const {
200189 constinit static std::array<std::pair<intmax_t , intmax_t >, 8 > dims {{
201190 {Q::mass::num, Q::mass::den},
@@ -406,8 +395,8 @@ constexpr Number operator""_num(unsigned long long value) {
406395}
407396
408397template <> struct std ::formatter<Number> : std::formatter<double > {
409- auto format (const Number& quantity , std::format_context& ctx) const {
410- return std::format_to (ctx. out (), " {} " , quantity. internal () );
398+ auto format (const Number& number , std::format_context& ctx) const {
399+ return std::formatter< double >:: format (number. internal (), ctx );
411400 }
412401};
413402
0 commit comments