forked from mpusz/mp-units
Base dimensions refactored
-
This commit is contained in:
@@ -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>> {};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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>>>);
|
||||
|
||||
Reference in New Issue
Block a user