|
Boost : |
From: Ruben Perez (rubenperez038_at_[hidden])
Date: 2024-01-13 16:05:04
Hi all,
Since we will be reviewing Boost.CharConv shortly, and my development
efforts in Boost.MySQL are currently requiring converting numbers to
strings, I've been playing with the utilities we currently have to do so.
I've found cases where I just needed to convert something to string, then
pass the result to another function taking a string_view as parameter.
The most efficient and correct way to do so is using to_chars (stack based,
non-throwing, C++23 constexpr and locale-independent). But I still like
the simplicity of std::to_string.
Since I had some free time this weekend, I took a step forward and implemented
a (deadly simple) wrapper around to_chars that looks like std::to_string, but
has all the benefits of to_chars. I called this to_static_string. Repo is here:
https://github.com/anarthal/to-static-string
This is currently a prototype. I want to hear everyone's opinion on this - do
you think this may be useful to any of you? I don't think it's big enough to
even consider putting it into Boost (my idea is having it as a standalone lib).
Any comments are welcome.
Thanks,
Ruben.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk