Date: Sat, 19 Oct 2024 21:39:16 -0700
On Saturday 19 October 2024 10:24:18 GMT-7 Jonathan Wakely via Std-Proposals
wrote:
> std::stoi(wstring_view) is trickier, as we don't have a wide from_chars, so
> that still needs to use wcstol, which requires a null-terminated string.
You can do a narrow-encode translation on the fly, using a stack variable,
because for integers, the length of a string representation is also limited,
not counting the zeroes to the left. If the string is longer than the buffer,
then it's automatically an out-of-range error.
That said, yes, we'd appreciate char16_t std::from_chars.
wrote:
> std::stoi(wstring_view) is trickier, as we don't have a wide from_chars, so
> that still needs to use wcstol, which requires a null-terminated string.
You can do a narrow-encode translation on the fly, using a stack variable,
because for integers, the length of a string representation is also limited,
not counting the zeroes to the left. If the string is longer than the buffer,
then it's automatically an out-of-range error.
That said, yes, we'd appreciate char16_t std::from_chars.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel DCAI Platform & System Engineering
Received on 2024-10-20 04:39:20