C++ Logo

std-proposals

Advanced search

Re: [std-proposals] string_view support for std::stoi and friends

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 13 Jan 2025 13:41:52 -0800
On Monday 13 January 2025 12:51:51 Pacific Standard Time Jonathan Wakely via
Std-Proposals wrote:
> Why not change std::stoi to be that one-liner, which is almost what's being
> proposed?

Because it isn't. And that's the issue: stoi does more than just parse the
numbers. It also handles whitespace before the number, the plus sign, and 0,
0b and 0x prefix for when applicable for the base in question.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-01-13 21:41:53