forked from mpusz/mp-units
refactor: UDLs support switched off by default
This commit is contained in:
@@ -43,14 +43,14 @@ Energy auto total_energy(Momentum auto p, Mass auto m, Speed auto c)
|
||||
void si_example()
|
||||
{
|
||||
using namespace units::isq::si;
|
||||
using GeV = gigaelectronvolt;
|
||||
using namespace units::isq::si::references;
|
||||
|
||||
constexpr Speed auto c = si2019::speed_of_light<>;
|
||||
|
||||
std::cout << "\n*** SI units (c = " << c << ") ***\n";
|
||||
|
||||
const Momentum auto p = 4._q_GeV / c;
|
||||
const Mass auto m = 3._q_GeV / pow<2>(c);
|
||||
const Momentum auto p = 4. * GeV / c;
|
||||
const Mass auto m = 3. * GeV / pow<2>(c);
|
||||
const Energy auto E = total_energy(p, m, c);
|
||||
|
||||
std::cout << "[in GeV]\n"
|
||||
@@ -68,17 +68,16 @@ void si_example()
|
||||
<< "E = " << E_si << "\n";
|
||||
|
||||
std::cout << "\n[converted from SI units back to GeV]\n"
|
||||
<< "E = " << quantity_cast<GeV>(E_si) << "\n";
|
||||
<< "E = " << quantity_cast<gigaelectronvolt>(E_si) << "\n";
|
||||
}
|
||||
|
||||
void natural_example()
|
||||
{
|
||||
using namespace units::isq::natural;
|
||||
using GeV = gigaelectronvolt;
|
||||
|
||||
constexpr Speed auto c = speed_of_light<>;
|
||||
const momentum<GeV> p(4);
|
||||
const mass<GeV> m(3);
|
||||
const momentum<gigaelectronvolt> p(4);
|
||||
const mass<gigaelectronvolt> m(3);
|
||||
const Energy auto E = total_energy(p, m, c);
|
||||
|
||||
std::cout << "\n*** Natural units (c = " << c << ") ***\n"
|
||||
|
||||
Reference in New Issue
Block a user