@@ -184,18 +184,7 @@ template <isQuantity Q, typename quotient> using Rooted = Named<
184
184
std::ratio_divide<typename Q::angle, quotient>, std::ratio_divide<typename Q::temperature, quotient>,
185
185
std::ratio_divide<typename Q::luminosity, quotient>, std::ratio_divide<typename Q::moles, quotient>>>;
186
186
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 > {
199
188
auto format (const Q& quantity, std::format_context& ctx) const {
200
189
constinit static std::array<std::pair<intmax_t , intmax_t >, 8 > dims {{
201
190
{Q::mass::num, Q::mass::den},
@@ -406,8 +395,8 @@ constexpr Number operator""_num(unsigned long long value) {
406
395
}
407
396
408
397
template <> 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 );
411
400
}
412
401
};
413
402
0 commit comments