Physical units put in the physical namespace (I am sorry)

This commit is contained in:
Mateusz Pusz
2020-05-08 22:39:24 +02:00
parent 771a9a1551
commit 7e935a4108
117 changed files with 352 additions and 349 deletions
+9 -8
View File
@@ -25,23 +25,24 @@
namespace {
template<units::Length D, units::Time T>
constexpr units::Velocity AUTO avg_speed(D d, T t)
template<units::physical::Length D, units::physical::Time T>
constexpr units::physical::Velocity AUTO avg_speed(D d, T t)
{
return d / t;
}
void example()
{
using namespace units::si::literals;
using namespace units::physical;
using namespace units::physical::si::literals;
units::Length AUTO d1 = 123q_m;
units::Time AUTO t1 = 10q_s;
units::Velocity AUTO v1 = avg_speed(d1, t1);
Length AUTO d1 = 123q_m;
Time AUTO t1 = 10q_s;
Velocity AUTO v1 = avg_speed(d1, t1);
auto temp1 = v1 * 50q_m; // produces intermediate unknown dimension with 'unknown_coherent_unit' as its 'coherent_unit'
units::Velocity AUTO v2 = temp1 / 100q_m; // back to known dimensions again
units::Length AUTO d2 = v2 * 60q_s;
Velocity AUTO v2 = temp1 / 100q_m; // back to known dimensions again
Length AUTO d2 = v2 * 60q_s;
std::cout << "d1 = " << d1 << '\n';
std::cout << "t1 = " << t1 << '\n';