mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-01 11:24:27 +02:00
refactor: degree Celsius and Fahrenheit symbols text now use Unicode codepoints
This commit is contained in:
@@ -316,7 +316,7 @@ marked `final` (:boom: **breaking change** :boom:).
|
||||
|
||||
inline constexpr struct ice_point final : relative_point_origin<quantity_point{273'150 * milli<kelvin>}> {} ice_point;
|
||||
inline constexpr auto zeroth_degree_Celsius = ice_point;
|
||||
inline constexpr struct degree_Celsius final : named_unit<symbol_text{u8"°C", "`C"}, kelvin, zeroth_degree_Celsius> {} degree_Celsius;
|
||||
inline constexpr struct degree_Celsius final : named_unit<symbol_text{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {} degree_Celsius;
|
||||
```
|
||||
|
||||
=== "Before"
|
||||
@@ -331,7 +331,7 @@ marked `final` (:boom: **breaking change** :boom:).
|
||||
|
||||
inline constexpr struct ice_point : relative_point_origin<quantity_point{273'150 * milli<kelvin>}> {} ice_point;
|
||||
inline constexpr struct zeroth_degree_Celsius : decltype(ice_point) {} zeroth_degree_Celsius;
|
||||
inline constexpr struct degree_Celsius : named_unit<symbol_text{u8"°C", "`C"}, kelvin, zeroth_degree_Celsius> {} degree_Celsius;
|
||||
inline constexpr struct degree_Celsius : named_unit<symbol_text{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {} degree_Celsius;
|
||||
```
|
||||
|
||||
Please also note, that the `absolute_point_origin` does not use CRTP idiom anymore (:boom: **breaking change** :boom:).
|
||||
|
@@ -292,7 +292,7 @@ This introduces an additional type-safety.
|
||||
The above outputs:
|
||||
|
||||
```text
|
||||
Temperature: 20 °C (68 °F)
|
||||
Temperature: 20 ℃ (68 ℉)
|
||||
```
|
||||
|
||||
!!! info
|
||||
|
@@ -445,14 +445,14 @@ namespace si {
|
||||
inline constexpr struct kelvin final :
|
||||
named_unit<"K", kind_of<isq::thermodynamic_temperature>, zeroth_kelvin> {} kelvin;
|
||||
inline constexpr struct degree_Celsius final :
|
||||
named_unit<{u8"°C", "`C"}, kelvin, zeroth_degree_Celsius> {} degree_Celsius;
|
||||
named_unit<{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {} degree_Celsius;
|
||||
|
||||
}
|
||||
|
||||
namespace usc {
|
||||
|
||||
inline constexpr struct degree_Fahrenheit final :
|
||||
named_unit<{u8"°F", "`F"}, mag_ratio<5, 9> * si::degree_Celsius,
|
||||
named_unit<{u8"℉", "`F"}, mag_ratio<5, 9> * si::degree_Celsius,
|
||||
zeroth_degree_Fahrenheit> {} degree_Fahrenheit;
|
||||
|
||||
}
|
||||
@@ -532,13 +532,13 @@ print_temp("Highest", room_high);
|
||||
The above prints:
|
||||
|
||||
```text
|
||||
Room reference temperature: 21 °C (69.8 °F, 294.15 K)
|
||||
Room reference temperature: 21 ℃ (69.8 ℉, 294.15 K)
|
||||
|
||||
| Temperature delta | Room reference | Ice point | Absolute zero |
|
||||
|====================|====================|====================|====================|
|
||||
| Lowest | -3 °C | 18 °C | 291.15 °C |
|
||||
| Default | 0 °C | 21 °C | 294.15 °C |
|
||||
| Highest | 3 °C | 24 °C | 297.15 °C |
|
||||
| Lowest | -3 ℃ | 18 ℃ | 291.15 ℃ |
|
||||
| Default | 0 ℃ | 21 ℃ | 294.15 ℃ |
|
||||
| Highest | 3 ℃ | 24 ℃ | 297.15 ℃ |
|
||||
```
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user