mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-01 03:14:29 +02:00
Limited number of places where common_type is being used on quantities
For some specific mathematical types different type might be returned from division, mulitplication, substraction, etc. std::common_type<> does not have an information which operation is being performed. It is much better to just get the actual result of specific operation.
This commit is contained in:
@@ -249,11 +249,11 @@ namespace {
|
||||
|
||||
static_assert(Quantity<length<millimeter, int>>);
|
||||
|
||||
// common_type
|
||||
// common_quantity
|
||||
|
||||
static_assert(std::is_same_v<std::common_type_t<length<meter, int>, length<kilometer, int>>, length<meter, int>>);
|
||||
static_assert(std::is_same_v<std::common_type_t<length<kilometer, long long>, length<meter, int>>, length<meter, long long>>);
|
||||
static_assert(std::is_same_v<std::common_type_t<length<kilometer, long long>, length<millimeter, double>>, length<millimeter, double>>);
|
||||
static_assert(std::is_same_v<common_quantity_t<length<meter, int>, length<kilometer, int>>, length<meter, int>>);
|
||||
static_assert(std::is_same_v<common_quantity_t<length<kilometer, long long>, length<meter, int>>, length<meter, long long>>);
|
||||
static_assert(std::is_same_v<common_quantity_t<length<kilometer, long long>, length<millimeter, double>>, length<millimeter, double>>);
|
||||
|
||||
// quantity_cast
|
||||
|
||||
|
Reference in New Issue
Block a user