On Wednesday, October 8th, 2025 at 9:53 AM, Richard Hodges via Boost <boost@lists.boost.org> wrote:
- What is your evaluation of the design?
There seems to be no way to construct a boost.decimal from a string representing a decimal number.
Is that correct, or have I missed it?
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]. There are also literals if you prefer to go that route [2].
Almost all financial systems (an obvious candidate for a class such as this) spend most of their time converting decimals to strings and strings to decimals. I see that serialisation is covered by fmt integration, but what about parsing?
R
Does {fmt} even support parsing beyond parsing of the context? I am not aware of that if it does. Matt [1] https://develop.decimal.cpp.al/decimal/charconv.html [2] https://develop.decimal.cpp.al/decimal/literals.html