All UDLs are now prefixed with q_

This commit is contained in:
Mateusz Pusz
2020-02-17 15:56:06 +01:00
parent 0566cc631d
commit 18620044c5
65 changed files with 768 additions and 768 deletions

View File

@@ -130,12 +130,12 @@ void simple_quantities()
using distance = length::m<>;
using time = time::s<>;
constexpr distance km = 1.0km;
constexpr distance miles = 1.0mi;
constexpr distance km = 1.0q_km;
constexpr distance miles = 1.0q_mi;
constexpr time sec = 1s;
constexpr time min = 1min;
constexpr time hr = 1h;
constexpr time sec = 1q_s;
constexpr time min = 1q_min;
constexpr time hr = 1q_h;
std::cout << "A physical quantities library can choose the simple\n";
std::cout << "option to provide output using a single type for each base unit:\n\n";
@@ -148,14 +148,14 @@ void simple_quantities()
void quantities_with_typed_units()
{
constexpr length::km<> km = 1.0km;
constexpr length::mi<> miles = 1.0mi;
constexpr length::km<> km = 1.0q_km;
constexpr length::mi<> miles = 1.0q_mi;
std::cout.precision(6);
constexpr time::s<> sec = 1s;
constexpr time::min<> min = 1min;
constexpr time::h<> hr = 1h;
constexpr time::s<> sec = 1q_s;
constexpr time::min<> min = 1q_min;
constexpr time::h<> hr = 1q_h;
std::cout << "A more flexible option is to provide separate types for each unit,\n\n";
std::cout << km << '\n';
@@ -164,7 +164,7 @@ void quantities_with_typed_units()
std::cout << min << '\n';
std::cout << hr << "\n\n";
constexpr length::m<> meter = 1m;
constexpr length::m<> meter = 1q_m;
std::cout << "then a wide range of pre-defined units can be defined and converted,\n"
" for consistency and repeatability across applications:\n\n";
@@ -197,8 +197,8 @@ void calcs_comparison()
"when adding two values of the same very big\n"
"or very small type:\n\n";
length::fm<float> L1A = 2fm;
length::fm<float> L2A = 3fm;
length::fm<float> L1A = 2q_fm;
length::fm<float> L2A = 3q_fm;
length::fm<float> LrA = L1A + L2A;
std::cout << L1A << " + " << L2A << " = " << LrA << "\n\n";