mirror of
https://github.com/nlohmann/json.git
synced 2024-08-23 05:22:28 +02:00
reverted “fix” for issue #107
This commit is contained in:
parent
b431203fe8
commit
11ae6da6d9
17
src/json.hpp
17
src/json.hpp
|
@ -49,7 +49,6 @@ Class @ref nlohmann::basic_json is a good entry point for the documentation.
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <locale>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -6933,18 +6932,18 @@ basic_json_parser_59:
|
||||||
read past the current token. The latter case needs to be treated by the
|
read past the current token. The latter case needs to be treated by the
|
||||||
caller function.
|
caller function.
|
||||||
|
|
||||||
@note This function is locale-independent, see
|
|
||||||
http://stackoverflow.com/a/1333899/266378
|
|
||||||
|
|
||||||
@throw std::range_error if passed value is out of range
|
@throw std::range_error if passed value is out of range
|
||||||
*/
|
*/
|
||||||
long double get_number() const
|
long double get_number() const
|
||||||
{
|
{
|
||||||
long double f = NAN;
|
// conversion
|
||||||
std::stringstream ss(get_token());
|
typename string_t::value_type* endptr;
|
||||||
ss.imbue(std::locale("C"));
|
const auto float_val = std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start),
|
||||||
ss >> f;
|
&endptr);
|
||||||
return f;
|
|
||||||
|
// return float_val if the whole number was translated and NAN
|
||||||
|
// otherwise
|
||||||
|
return (reinterpret_cast<lexer_char_t*>(endptr) == m_cursor) ? float_val : NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -49,7 +49,6 @@ Class @ref nlohmann::basic_json is a good entry point for the documentation.
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <locale>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -6239,18 +6238,18 @@ class basic_json
|
||||||
read past the current token. The latter case needs to be treated by the
|
read past the current token. The latter case needs to be treated by the
|
||||||
caller function.
|
caller function.
|
||||||
|
|
||||||
@note This function is locale-independent, see
|
|
||||||
http://stackoverflow.com/a/1333899/266378
|
|
||||||
|
|
||||||
@throw std::range_error if passed value is out of range
|
@throw std::range_error if passed value is out of range
|
||||||
*/
|
*/
|
||||||
long double get_number() const
|
long double get_number() const
|
||||||
{
|
{
|
||||||
long double f = NAN;
|
// conversion
|
||||||
std::stringstream ss(get_token());
|
typename string_t::value_type* endptr;
|
||||||
ss.imbue(std::locale("C"));
|
const auto float_val = std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start),
|
||||||
ss >> f;
|
&endptr);
|
||||||
return f;
|
|
||||||
|
// return float_val if the whole number was translated and NAN
|
||||||
|
// otherwise
|
||||||
|
return (reinterpret_cast<lexer_char_t*>(endptr) == m_cursor) ? float_val : NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue