![]() |
|
|||
File indexing completed on 2025-04-19 08:19:38
0001 // Copyright 2020-2023 Daniel Lemire 0002 // Copyright 2023 Matt Borland 0003 // Distributed under the Boost Software License, Version 1.0. 0004 // https://www.boost.org/LICENSE_1_0.txt 0005 // 0006 // Derivative of: https://github.com/fastfloat/fast_float 0007 0008 #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_FLOAT_HPP 0009 #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_FLOAT_HPP 0010 0011 #include <boost/charconv/detail/fast_float/float_common.hpp> 0012 0013 namespace boost { namespace charconv { namespace detail { namespace fast_float { 0014 /** 0015 * This function parses the character sequence [first,last) for a number. It parses floating-point numbers expecting 0016 * a locale-independent format equivalent to what is used by std::strtod in the default ("C") locale. 0017 * The resulting floating-point value is the closest floating-point values (using either float or double), 0018 * using the "round to even" convention for values that would otherwise fall right in-between two values. 0019 * That is, we provide exact parsing according to the IEEE standard. 0020 * 0021 * Given a successful parse, the pointer (`ptr`) in the returned value is set to point right after the 0022 * parsed number, and the `value` referenced is set to the parsed value. In case of error, the returned 0023 * `ec` contains a representative error, otherwise the default (`std::errc()`) value is stored. 0024 * 0025 * The implementation does not throw and does not allocate memory (e.g., with `new` or `malloc`). 0026 * 0027 * Like the C++17 standard, the `fast_float::from_chars` functions take an optional last argument of 0028 * the type `fast_float::chars_format`. It is a bitset value: we check whether 0029 * `fmt & fast_float::chars_format::fixed` and `fmt & fast_float::chars_format::scientific` are set 0030 * to determine whether we allow the fixed point and scientific notation respectively. 0031 * The default is `fast_float::chars_format::general` which allows both `fixed` and `scientific`. 0032 */ 0033 template<typename T, typename UC = char> 0034 BOOST_CHARCONV_FASTFLOAT_CONSTEXPR20 0035 from_chars_result_t<UC> from_chars(UC const * first, UC const * last, 0036 T &value, chars_format fmt = chars_format::general) noexcept; 0037 0038 /** 0039 * Like from_chars, but accepts an `options` argument to govern number parsing. 0040 */ 0041 template<typename T, typename UC = char> 0042 BOOST_CHARCONV_FASTFLOAT_CONSTEXPR20 0043 from_chars_result_t<UC> from_chars_advanced(UC const * first, UC const * last, 0044 T &value, parse_options_t<UC> options) noexcept; 0045 0046 }}}} // namespace fast_float 0047 #include <boost/charconv/detail/fast_float/parse_number.hpp> 0048 #endif // BOOST_CHARCONV_FASTFLOAT_FAST_FLOAT_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |