Skip to content

Commit

Permalink
refactor: framework Unicode symbols are now spelled using their codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Oct 23, 2024
1 parent 1e38b27 commit 08b6a51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/core/include/mp-units/framework/magnitude.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ constexpr Out print_separator(Out out, const unit_symbol_formatting& fmt)
if (fmt.encoding != text_encoding::utf8)
MP_UNITS_THROW(
std::invalid_argument("'unit_symbol_separator::half_high_dot' can be only used with 'text_encoding::utf8'"));
const std::string_view dot = "";
const std::string_view dot = "\u22C5";
out = detail::copy(dot.begin(), dot.end(), out);
} else {
*out++ = ' ';
Expand Down Expand Up @@ -393,7 +393,7 @@ constexpr Out magnitude_symbol_impl(Out out, const unit_symbol_formatting& fmt)

if constexpr (Exp10 != 0) {
if (numerator || denominator) {
constexpr auto mag_multiplier = symbol_text(u8" × ", " x ");
constexpr auto mag_multiplier = symbol_text(u8" \u00D7 ", " x ");
out = copy_symbol<CharT>(mag_multiplier, fmt.encoding, negative_power, out);
}
constexpr auto exp = symbol_text("10") + detail::superscript<Exp10>();
Expand Down Expand Up @@ -690,10 +690,10 @@ constexpr Magnitude auto mag_power = _pow<Num, Den>(mag<Base>);
* @brief A convenient Magnitude constant for pi, which we can manipulate like a regular number.
*/
#if defined MP_UNITS_COMP_CLANG || MP_UNITS_COMP_CLANG < 18
inline constexpr struct pi final : mag_constant<symbol_text{u8"𝜋", "pi"}> {
inline constexpr struct pi final : mag_constant<symbol_text{u8"\U0001D70B", "pi"}> {
static constexpr auto _value_ = std::numbers::pi_v<long double>;
#else
inline constexpr struct pi final : mag_constant<symbol_text{u8"𝜋", "pi"}, std::numbers::pi_v<long double>> {
inline constexpr struct pi final : mag_constant<symbol_text{u8"\U0001D70B", "pi"}, std::numbers::pi_v<long double>> {
#endif
} pi;
inline constexpr auto 𝜋 = pi;
Expand Down
2 changes: 1 addition & 1 deletion src/core/include/mp-units/framework/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ template<std::intmax_t Num, std::intmax_t Den = 1, Unit U>
// common dimensionless units
// clang-format off
inline constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent;
inline constexpr struct per_mille final : named_unit<symbol_text{u8"", "%o"}, mag_ratio<1, 1000> * one> {} per_mille;
inline constexpr struct per_mille final : named_unit<symbol_text{u8"\u2030", "%o"}, mag_ratio<1, 1000> * one> {} per_mille;
inline constexpr struct parts_per_million final : named_unit<"ppm", mag_ratio<1, 1'000'000> * one> {} parts_per_million;
inline constexpr auto ppm = parts_per_million;
// clang-format on
Expand Down

0 comments on commit 08b6a51

Please sign in to comment.