mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-02-09 11:16:45 +08:00
Implement prefix skipping in from_chars_advanced
This commit is contained in:
parent
4abcd6059b
commit
456e4c5eb6
@ -476,6 +476,14 @@ template <typename T, typename UC>
|
||||
FASTFLOAT_CONSTEXPR20 from_chars_result_t<UC>
|
||||
from_chars_advanced(UC const *first, UC const *last, T &value,
|
||||
parse_options_t<UC> options) noexcept {
|
||||
if ((options.format_options & parse_options_t<UC>::skip_prefix) != 0) {
|
||||
if ((last - first) >= 2 && *first == UC('0')) {
|
||||
if ((first[1] == UC('x') || first[1] == UC('X')) ||
|
||||
(first[1] == UC('b') || first[1] == UC('B'))) {
|
||||
first += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return from_chars_advanced_caller<
|
||||
size_t(is_supported_float_type<T>::value) +
|
||||
2 * size_t(is_supported_integer_type<T>::value)>::call(first, last, value,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user