mirror of
https://github.com/nlohmann/json.git
synced 2026-10-01 06:25:17 +00:00
Address the clang-tidy findings of values and JSON pointers
get_string() and number_token() return braced lists; the test compares floats by their bit patterns instead of with memcmp, uses std::any_of, and marks a fixed seed, a default member initializer (needed by GCC's -Weffc++), and a string search. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -532,7 +532,7 @@ class basic_json_view
|
||||
{
|
||||
detail::view::throw_type_error(302, "type must be string, but is ", type_name());
|
||||
}
|
||||
return string_view_t(m_doc->str(*m_node), m_node->len);
|
||||
return {m_doc->str(*m_node), m_node->len};
|
||||
}
|
||||
|
||||
/// the text of a number as it appears in the source (e.g. "1.50", "1E2",
|
||||
@@ -544,7 +544,7 @@ class basic_json_view
|
||||
{
|
||||
detail::view::throw_type_error(302, "type must be number, but is ", type_name());
|
||||
}
|
||||
return string_view_t(m_doc->str(*m_node), detail::view::number_length(*m_node));
|
||||
return {m_doc->str(*m_node), detail::view::number_length(*m_node)};
|
||||
}
|
||||
|
||||
/////////////////
|
||||
|
||||
Reference in New Issue
Block a user