23template <
class Units,
typename T,
template <
typename>
class NonLinearScale>
25 : fmt::formatter<double> {
33 template <
typename FormatContext>
38 typename units::traits::unit_traits<Units>::base_unit_type>;
43 units::convert<Units, BaseUnits>(obj()), ctx);
45 if constexpr (units::traits::unit_traits<
46 Units>::base_unit_type::meter_ratio::num != 0) {
49 if constexpr (units::traits::unit_traits<
50 Units>::base_unit_type::meter_ratio::num != 0 &&
51 units::traits::unit_traits<
52 Units>::base_unit_type::meter_ratio::num != 1) {
55 units::traits::unit_traits<Units>::base_unit_type::meter_ratio::num);
57 if constexpr (units::traits::unit_traits<
58 Units>::base_unit_type::meter_ratio::den != 1) {
61 units::traits::unit_traits<Units>::base_unit_type::meter_ratio::den);
64 if constexpr (units::traits::unit_traits<
65 Units>::base_unit_type::kilogram_ratio::num != 0) {
68 if constexpr (units::traits::unit_traits<
69 Units>::base_unit_type::kilogram_ratio::num != 0 &&
70 units::traits::unit_traits<
71 Units>::base_unit_type::kilogram_ratio::num != 1) {
73 units::traits::unit_traits<
74 Units>::base_unit_type::kilogram_ratio::num);
76 if constexpr (units::traits::unit_traits<
77 Units>::base_unit_type::kilogram_ratio::den != 1) {
79 units::traits::unit_traits<
80 Units>::base_unit_type::kilogram_ratio::den);
83 if constexpr (units::traits::unit_traits<
84 Units>::base_unit_type::second_ratio::num != 0) {
87 if constexpr (units::traits::unit_traits<
88 Units>::base_unit_type::second_ratio::num != 0 &&
89 units::traits::unit_traits<
90 Units>::base_unit_type::second_ratio::num != 1) {
93 units::traits::unit_traits<Units>::base_unit_type::second_ratio::num);
95 if constexpr (units::traits::unit_traits<
96 Units>::base_unit_type::second_ratio::den != 1) {
99 units::traits::unit_traits<Units>::base_unit_type::second_ratio::den);
102 if constexpr (units::traits::unit_traits<
103 Units>::base_unit_type::ampere_ratio::num != 0) {
106 if constexpr (units::traits::unit_traits<
107 Units>::base_unit_type::ampere_ratio::num != 0 &&
108 units::traits::unit_traits<
109 Units>::base_unit_type::ampere_ratio::num != 1) {
112 units::traits::unit_traits<Units>::base_unit_type::ampere_ratio::num);
114 if constexpr (units::traits::unit_traits<
115 Units>::base_unit_type::ampere_ratio::den != 1) {
118 units::traits::unit_traits<Units>::base_unit_type::ampere_ratio::den);
121 if constexpr (units::traits::unit_traits<
122 Units>::base_unit_type::kelvin_ratio::num != 0) {
125 if constexpr (units::traits::unit_traits<
126 Units>::base_unit_type::kelvin_ratio::num != 0 &&
127 units::traits::unit_traits<
128 Units>::base_unit_type::kelvin_ratio::num != 1) {
131 units::traits::unit_traits<Units>::base_unit_type::kelvin_ratio::num);
133 if constexpr (units::traits::unit_traits<
134 Units>::base_unit_type::kelvin_ratio::den != 1) {
137 units::traits::unit_traits<Units>::base_unit_type::kelvin_ratio::den);
140 if constexpr (units::traits::unit_traits<
141 Units>::base_unit_type::mole_ratio::num != 0) {
144 if constexpr (units::traits::unit_traits<
145 Units>::base_unit_type::mole_ratio::num != 0 &&
146 units::traits::unit_traits<
147 Units>::base_unit_type::mole_ratio::num != 1) {
150 units::traits::unit_traits<Units>::base_unit_type::mole_ratio::num);
152 if constexpr (units::traits::unit_traits<
153 Units>::base_unit_type::mole_ratio::den != 1) {
156 units::traits::unit_traits<Units>::base_unit_type::mole_ratio::den);
159 if constexpr (units::traits::unit_traits<
160 Units>::base_unit_type::candela_ratio::num != 0) {
163 if constexpr (units::traits::unit_traits<
164 Units>::base_unit_type::candela_ratio::num != 0 &&
165 units::traits::unit_traits<
166 Units>::base_unit_type::candela_ratio::num != 1) {
168 units::traits::unit_traits<
169 Units>::base_unit_type::candela_ratio::num);
171 if constexpr (units::traits::unit_traits<
172 Units>::base_unit_type::candela_ratio::den != 1) {
174 units::traits::unit_traits<
175 Units>::base_unit_type::candela_ratio::den);
178 if constexpr (units::traits::unit_traits<
179 Units>::base_unit_type::radian_ratio::num != 0) {
182 if constexpr (units::traits::unit_traits<
183 Units>::base_unit_type::radian_ratio::num != 0 &&
184 units::traits::unit_traits<
185 Units>::base_unit_type::radian_ratio::num != 1) {
188 units::traits::unit_traits<Units>::base_unit_type::radian_ratio::num);
190 if constexpr (units::traits::unit_traits<
191 Units>::base_unit_type::radian_ratio::den != 1) {
194 units::traits::unit_traits<Units>::base_unit_type::radian_ratio::den);
197 if constexpr (units::traits::unit_traits<
198 Units>::base_unit_type::byte_ratio::num != 0) {
201 if constexpr (units::traits::unit_traits<
202 Units>::base_unit_type::byte_ratio::num != 0 &&
203 units::traits::unit_traits<
204 Units>::base_unit_type::byte_ratio::num != 1) {
207 units::traits::unit_traits<Units>::base_unit_type::byte_ratio::num);
209 if constexpr (units::traits::unit_traits<
210 Units>::base_unit_type::byte_ratio::den != 1) {
213 units::traits::unit_traits<Units>::base_unit_type::byte_ratio::den);
Container for values which represent quantities of a given unit.
Definition: base.h:1926
Unit Conversion Library namespace.
Definition: current.h:31
Type representing an arbitrary unit.
Definition: base.h:884
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition: xchar.h:87
auto format_to(OutputIt out, const S &fmt, Args &&... args) -> OutputIt
Definition: xchar.h:136