31 Jan
2024
31 Jan
'24
12:23 p.m.
I'm not a reviewer, but I'd like to add a note on the interface:
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;
Reason: Right now there is no simple, non-throwing way of converting a string to a number in C++ as std::stoi/std::stof throws exceptions on errors.
Best/Viktor
Viktor, Thanks for the suggestion. I can add some additional interfaces for to/from number to the library since they are pretty straightforward. Similar comments came up during the review such as supporting string_view instead of pointer pairs. Matt