derived_unit helper added

This commit is contained in:
Mateusz Pusz
2019-04-11 13:36:06 +01:00
parent e12fb2f52a
commit 709e1190af
5 changed files with 84 additions and 17 deletions

View File

@@ -38,12 +38,7 @@ namespace {
using namespace units;
// frequency
static_assert(2 / 1_s == 2_Hz);
static_assert(1000 / 1_s == 1_kHz);
static_assert(1 / 1_ms == 1_kHz);
static_assert(3.2_GHz == 3'200'000'000_Hz);
/* ************** BASE DIMENSIONS **************** */
// time
@@ -65,6 +60,17 @@ namespace {
// static_assert(5_in + 8_cm == 207_mm);
/* ************** DERIVED DIMENSIONS **************** */
// frequency
static_assert(2 / 1_s == 2_Hz);
static_assert(1000 / 1_s == 1_kHz);
static_assert(1 / 1_ms == 1_kHz);
static_assert(3.2_GHz == 3'200'000'000_Hz);
// velocity
static_assert(std::is_same_v<decltype(1_km / 1_s), velocity<unit<dimension_velocity, std::ratio<1000, 1>>, long long int>>);