Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: provide from_chars_advanced overload or other function name that takes parsed_number_string_t<UC> argument #248

Open
zejal opened this issue May 11, 2024 · 4 comments

Comments

@zejal
Copy link

zejal commented May 11, 2024

Idea would be to allow for existing parsing code and avoid copy pasting remainder of from_chars_advanced function.
Existing parser code would fill the parsed_number_string structure as appropriate.

@lemire
Copy link
Member

lemire commented May 11, 2024

It is difficult to discuss these things in the abstract. My recommendation is that you make a pull request and we can look at the code.

@zejal
Copy link
Author

zejal commented May 11, 2024

Not hugely familiar with github at this stage, unfortunately.
Based on last released fast_float.hpp you'd have:

template<typename T, typename UC>
FASTFLOAT_CONSTEXPR20
from_chars_result_t<UC> from_chars_advanced(const parsed_number_string_t<UC>& pns, T &value) noexcept {
// assert pns.valid ? or explicit check as in current function ? probably leave the check responsibility to caller ?
answer.ec = std::errc(); // be optimistic
// same lines as in existing from_chars_advanced.
// ...
}

@lemire
Copy link
Member

lemire commented May 11, 2024

@zejal
Copy link
Author

zejal commented May 11, 2024

Sure, I'll do my best to get familiar with how github works to work on changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants