refactor: First examples refactored to a new quantity creation syntax

This commit is contained in:
Mateusz Pusz
2022-12-22 18:06:20 +01:00
parent 0a1ee606f3
commit 858cbb472f
8 changed files with 46 additions and 46 deletions

View File

@@ -36,19 +36,19 @@ int main()
std::cout << "The seven defining constants of the SI and the seven corresponding units they define:\n";
std::cout << STD_FMT::format("- hyperfine transition frequency of Cs: {} = {:%.0Q %q}\n",
1. * si2019::hyperfine_structure_transition_frequency_of_cs,
(1. * si2019::hyperfine_structure_transition_frequency_of_cs)[Hz]);
si2019::hyperfine_structure_transition_frequency_of_cs(1.),
si2019::hyperfine_structure_transition_frequency_of_cs(1.)[Hz]);
std::cout << STD_FMT::format("- speed of light in vacuum: {} = {:%.0Q %q}\n",
1. * si2019::speed_of_light_in_vacuum, (1. * si2019::speed_of_light_in_vacuum)[m / s]);
si2019::speed_of_light_in_vacuum(1.), si2019::speed_of_light_in_vacuum(1.)[m / s]);
std::cout << STD_FMT::format("- Planck constant: {} = {:%.8eQ %q}\n",
1. * si2019::planck_constant, (1. * si2019::planck_constant)[J * s]);
si2019::planck_constant(1.), si2019::planck_constant(1.)[J * s]);
std::cout << STD_FMT::format("- elementary charge: {} = {:%.9eQ %q}\n",
1. * si2019::elementary_charge, (1. * si2019::elementary_charge)[C]);
si2019::elementary_charge(1.), si2019::elementary_charge(1.)[C]);
std::cout << STD_FMT::format("- Boltzmann constant: {} = {:%.6eQ %q}\n",
1. * si2019::boltzmann_constant, (1. * si2019::boltzmann_constant)[J / K]);
si2019::boltzmann_constant(1.), si2019::boltzmann_constant(1.)[J / K]);
std::cout << STD_FMT::format("- Avogadro constant: {} = {:%.8eQ %q}\n",
1. * si2019::avogadro_constant, (1. * si2019::avogadro_constant)[1 / mol]);
si2019::avogadro_constant(1.), si2019::avogadro_constant(1.)[1 / mol]);
// TODO uncomment the below when ISQ is done
// std::cout << STD_FMT::format("- luminous efficacy: {} = {}\n", 1. * si2019::luminous_efficacy,
// (1. * si2019::luminous_efficacy)[lm / W]);
// std::cout << STD_FMT::format("- luminous efficacy: {} = {}\n", si2019::luminous_efficacy(1.),
// si2019::luminous_efficacy(1.)[lm / W]);
}