Use one dump overload from the other

This commit is contained in:
Marius Elvert 2022-11-22 21:19:02 +01:00
parent 0a92a3615b
commit b37960b975

View File

@ -1267,21 +1267,15 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
const bool ensure_ascii = false, const bool ensure_ascii = false,
const error_handler_t error_handler = error_handler_t::strict) const const error_handler_t error_handler = error_handler_t::strict) const
{ {
string_t result; return dump(indent, indent_char, ensure_ascii, error_handler, [](basic_json const&, int) {return true;});
serializer s(detail::output_adapter<char, string_t>(result), indent_char, error_handler);
if (indent >= 0)
{
s.dump(*this, true, ensure_ascii, static_cast<unsigned int>(indent));
}
else
{
s.dump(*this, false, ensure_ascii, 0);
} }
return result; /// @name object inspection
} /// Functions to inspect the type of a JSON value.
/// @{
/// @brief serialization
/// @sa https://json.nlohmann.me/api/basic_json/dump/
template <typename PrettyPrintPredicate> template <typename PrettyPrintPredicate>
string_t dump(const int indent, string_t dump(const int indent,
const char indent_char, const char indent_char,