Base dimensions refactored

-
This commit is contained in:
Mateusz Pusz
2019-10-15 19:03:45 +02:00
parent c3c5a740d9
commit d31d2cf439
9 changed files with 108 additions and 68 deletions
+2 -1
View File
@@ -28,7 +28,7 @@
namespace {
struct base_dim_digital_information { static constexpr const char* value = "digital information"; };
struct base_dim_digital_information : units::base_dimension<"digital information", "b"> {};
struct digital_information : units::derived_dimension<digital_information, units::exp<base_dim_digital_information, 1>> {};
@@ -36,6 +36,7 @@ namespace {
concept DigitalInformation = units::QuantityOf<T, digital_information>;
using namespace units::hacks;
struct bit : units::derived_unit<bit, decltype("b"_fs), digital_information> {};
struct byte : units::derived_unit<byte, decltype("B"_fs), digital_information, units::ratio<8>> {};
+4 -4
View File
@@ -27,10 +27,10 @@ using namespace units;
namespace {
struct d0 { static constexpr const char* value = "d0"; };
struct d1 { static constexpr const char* value = "d1"; };
struct d2 { static constexpr const char* value = "d2"; };
struct d3 { static constexpr const char* value = "d3"; };
struct d0 : base_dimension<"d0", ""> {};
struct d1 : base_dimension<"d1", ""> {};
struct d2 : base_dimension<"d2", ""> {};
struct d3 : base_dimension<"d3", ""> {};
// exp_invert
+2 -2
View File
@@ -83,8 +83,8 @@ namespace {
std::is_same_v<type_list_split_half<type_list<int, long, double, float>>::second_list, type_list<double, float>>);
// type_list_merge_sorted
struct d0 { static constexpr const char* value = "d0"; };
struct d1 { static constexpr const char* value = "d1"; };
struct d0 : base_dimension<"d0", ""> {};
struct d1 : base_dimension<"d1", ""> {};
static_assert(std::is_same_v<type_list_merge_sorted<type_list<exp<d0, 1>>, type_list<exp<d1, 1>>, exp_less>,
type_list<exp<d0, 1>, exp<d1, 1>>>);