I've seen that all classes (decimal32_t, decimal64_t, and decimal128_t) can be implicitly constructed from an integer, but not from a floating-point number. Which is the reason for this design choice? And if there's any, wouldn't it be better to explain it in the documentation? Best regards, LoS On Wed, Oct 8, 2025 at 2:06 PM Matt Borland via Boost <boost@lists.boost.org> wrote:
On Wed, Oct 8, 2025 at 5:11 PM Matt Borland via Boost boost@lists.boost.org wrote:
Without a constructor or conversion mechanism from string, when using decimal to store numbers received off the wire one would either have to round trip through (lossy) strtod or write a conversion function, which is tiresome.
The best way to do this (and how current users are) is via the <charconv> functions[1].
I'd like it to allow a leading plus sign. Wouldn't it be more convenient to use the `strtod` family (e.g. `strtod64`) instead of `from_chars`?
I think Peter covers the argument against that above [1]. If we use issues as a proxy for how much a feature is being used <charconv> followed by {fmt} are being used way more extensively than the strtod family.
Matt
[1] https://lists.boost.org/archives/list/boost@lists.boost.org/message/SK43DRVG... _______________________________________________ Boost mailing list -- boost@lists.boost.org To unsubscribe send an email to boost-leave@lists.boost.org https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/boost@lists.boost.org/message/LKEKQPOW...