Printing of uknown non-coherent units fixed

This commit is contained in:
Mateusz Pusz
2020-02-24 20:45:47 +01:00
parent 1f63fdb945
commit 0c02f94d29
2 changed files with 12 additions and 5 deletions
+7 -5
View File
@@ -145,12 +145,14 @@ constexpr auto unit_text()
return U::symbol;
}
else {
// print as a prefix or ratio of a reference unit
auto prefix_txt = prefix_or_ratio_text<typename U::ratio, typename U::reference::prefix_type>();
// print as a prefix or ratio of a coherent unit
using coherent_unit = dimension_unit<Dim>;
using ratio = ratio_divide<typename U::ratio, typename coherent_unit::ratio>;
auto prefix_txt = prefix_or_ratio_text<ratio, typename U::reference::prefix_type>();
if constexpr(has_symbol<typename U::reference>) {
// use predefined reference unit symbol
return prefix_txt + U::reference::symbol;
if constexpr(has_symbol<coherent_unit>) {
// use predefined coherent unit symbol
return prefix_txt + coherent_unit::symbol;
}
else {
// use derived dimension ingredients to create a unit symbol