Boost logo

Boost :

From: Ruben Perez (rubenperez038_at_[hidden])
Date: 2025-01-17 20:05:45


On Fri, 17 Jan 2025 at 21:01, Matt Borland <matt_at_[hidden]> wrote:
>
>
> > Another quick question:
> >
>
> > decimal::to_chars returns a structure that contains an error code and
> > a pointer, implying that the function can fail. Having a quick glance
> > at the implementation, it returns an error code if an invalid
> > character range is supplied (e.g. end_pointer < begin_pointer). Other
> > than that, can to_chars fail anyhow?
>
> It's designed to match the STL interface (and you can use the STL interface if you want with >= C++17). The only other fail case is not being able to fit the printed value in the buffer at the specified precision (or precision 6 for unspecified). You get std::errc::value_too_large in that case.

This makes sense to me. Thanks.

>
> Matt
>


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