>  What about this:

> inline constexpr struct pi final : mag_constant<symbol_text{u8"π" /* U+03C0 GREEK SMALL LETTER PI */, "pi"}, std::numbers::pi_v<long double>> {} pi;

> ?

Thanks, Jens! I think that is the most friendly approach, providing all the information at once. As no one seems to oppose it, I will use it for my code and wording.

Best

Mat

pt., 25 paź 2024 o 14:50 Jens Maurer <jens.maurer@gmx.net> napisał(a):


On 25/10/2024 09.03, Mateusz Pusz via SG16 wrote:
> One more question. It seems that we can define the same Unicode thing in many ways:
>
> inline constexpr struct pi final : mag_constant<symbol_text{u8"π", "pi"}, std::numbers::pi_v<long double>> {} pi;
> inline constexpr struct pi final : mag_constant<symbol_text{u8"\u03c0", "pi"}, std::numbers::pi_v<long double>> {} pi;
> inline constexpr struct pi final : mag_constant<symbol_text{u8"\N{GREEK SMALL LETTER PI}", "pi"}, std::numbers::pi_v<long double>> {} pi;
>
> We agreed that the first spelling is not the best choice. The second is already used to define chrono duration I/O (https://eel.is/c++draft/time.duration.io <https://eel.is/c++draft/time.duration.io>). However, maybe the third line provides the most information about what is going on?
> What is your opinion here?

For me, the last option conveys the most information.  On the other hand,
having the character number available also has value.
Note: The <chrono> specification predates named universal characters
(third option) in the core language.

What about this:

inline constexpr struct pi final : mag_constant<symbol_text{u8"π" /* U+03C0 GREEK SMALL LETTER PI */, "pi"}, std::numbers::pi_v<long double>> {} pi;

?


Jens