80 inline static constexpr T pow_constexpr(T a, T a_inv)
noexcept {
81 return details::pow_constexpr_fast_inv<power>(a, a_inv);
84 inline T pown(T a,
int n) {
return std::pow(a, n); }
153 T unit_temperature = 1,
156 :
s(1 / unit_time),
m(1 / unit_length),
kg(1 / unit_mass),
A(1 / unit_current),
157 K(1 / unit_temperature),
mol(1 / unit_qte),
cd(1 / unit_lumint),
s_inv(unit_time),
170 template<UnitPrefix pref = None, units::UnitName u,
int power = 1>
171 inline constexpr T
get() const noexcept;
233 template<UnitPrefix pref = None, units::UnitName u,
int power = 1>
234 inline constexpr T
to() {
235 return get<u, -power>();
239 template<units::UnitName u,
int power = 1>
240 inline constexpr T
get() {
241 return get<None, u, power>();
245 template<units::UnitName u,
int power = 1>
246 inline constexpr T
to() {
247 return to<None, u, power>();
251 template<UnitPrefix pref = None>
255 case units::second :
return get<pref, units::second>();
break;
256 case units::metre :
return get<pref, units::metre>();
break;
257 case units::kilogram:
return get<pref, units::kilogram>();
break;
258 case units::Ampere :
return get<pref, units::Ampere>();
break;
259 case units::Kelvin :
return get<pref, units::Kelvin>();
break;
260 case units::mole :
return get<pref, units::mole>();
break;
261 case units::candela :
return get<pref, units::candela>();
break;
263 case units::Hertz :
return get<pref, units::Hertz>();
break;
264 case units::Newton :
return get<pref, units::Newton>();
break;
265 case units::Pascal :
return get<pref, units::Pascal>();
break;
266 case units::Joule :
return get<pref, units::Joule>();
break;
267 case units::Watt :
return get<pref, units::Watt>();
break;
268 case units::Coulomb :
return get<pref, units::Coulomb>();
break;
269 case units::Volt :
return get<pref, units::Volt>();
break;
270 case units::Farad :
return get<pref, units::Farad>();
break;
271 case units::Ohm :
return get<pref, units::Ohm>();
break;
272 case units::Siemens :
return get<pref, units::Siemens>();
break;
273 case units::Weber :
return get<pref, units::Weber>();
break;
274 case units::Tesla :
return get<pref, units::Tesla>();
break;
275 case units::Henry :
return get<pref, units::Henry>();
break;
276 case units::lumens :
return get<pref, units::lumens>();
break;
277 case units::lux :
return get<pref, units::lux>();
break;
278 case units::Bequerel :
return get<pref, units::Bequerel>();
break;
279 case units::Gray :
return get<pref, units::Gray>();
break;
280 case units::Sievert :
return get<pref, units::Sievert>();
break;
281 case units::katal :
return get<pref, units::katal>();
break;
282 case units::minutes :
return get<pref, units::minutes>();
break;
283 case units::hours :
return get<pref, units::hours>();
break;
284 case units::days :
return get<pref, units::days>();
break;
285 case units::years :
return get<pref, units::years>();
break;
286 case units::astronomical_unit:
return get<pref, units::astronomical_unit>();
break;
287 case units::light_year :
return get<pref, units::light_year>();
break;
288 case units::parsec :
return get<pref, units::parsec>();
break;
289 case units::solar_radius :
return get<pref, units::solar_radius>();
break;
290 case units::earth_radius :
return get<pref, units::earth_radius>();
break;
291 case units::eV :
return get<pref, units::eV>();
break;
292 case units::erg :
return get<pref, units::erg>();
break;
293 case units::pint :
return get<pref, units::pint>();
break;
297 inline T getter_2(
UnitPrefix pref, units::UnitName name) {
300 case tera :
return getter_1<tera>(name);
break;
301 case giga :
return getter_1<giga>(name);
break;
302 case mega :
return getter_1<mega>(name);
break;
303 case kilo :
return getter_1<kilo>(name);
break;
304 case hecto:
return getter_1<hecto>(name);
break;
305 case deca :
return getter_1<deca>(name);
break;
306 case None :
return getter_1<None>(name);
break;
308 case centi:
return getter_1<centi>(name);
break;
309 case milli:
return getter_1<milli>(name);
break;
310 case micro:
return getter_1<micro>(name);
break;
311 case nano :
return getter_1<nano>(name);
break;
312 case pico :
return getter_1<pico>(name);
break;
313 case femto:
return getter_1<femto>(name);
break;
320 return pown(getter_2(pref, name), power);
325 return pown(getter_2(pref, name), -power);
UnitSystem(T unit_time=1, T unit_length=1, T unit_mass=1, T unit_current=1, T unit_temperature=1, T unit_qte=1, T unit_lumint=1)
Construct a new UnitSystem from either supplied base units or SI by default.