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:
Niels Lohmann
2026-09-29 00:43:16 +02:00
parent 9856da2561
commit bc36fd323b
3 changed files with 29 additions and 23 deletions

View File

@@ -3262,7 +3262,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",
@@ -3274,7 +3274,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)};
}
/////////////////