Boost logo

Boost :

From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2024-01-31 15:31:28


On Wed, Jan 31, 2024 at 1:38 PM Peter Dimov via Boost <boost_at_[hidden]>
wrote:

> Viktor Sehr wrote:
> > I think boost::charconv should add one convenience function as follows:
> > // Returns std::nullopt on error
> > template <typename NumberType>
> > std::optional<NumberType> boost::charconv::to_number(const
> > std::string_view& sv) noexcept;
>
> This throws away the error code
>

But sometimes that's all you want. That's kinda the point from Viktor I
guess.
Not that an `expected` or `outcome` return type is bad; but it is more
complex.

> [...] to avoid a dependency on <system_error> and therefore <string>

Hopefully one day with modules and `import std;` this will be a thing of
the past...
But that's I guess another completely different can of worms! --DD


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk