♻️ default initialization

This commit is contained in:
Niels Lohmann 2021-10-14 08:00:39 +02:00
parent d698b6bf26
commit 28ba5e49fe
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 2 additions and 20 deletions

View File

@ -3069,16 +3069,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept(
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init): see https://github.com/nlohmann/json/issues/3077
ValueType ret;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
auto ret = ValueType();
JSONSerializer<ValueType>::from_json(*this, ret);
return ret;
}

View File

@ -20556,16 +20556,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept(
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init,hicpp-member-init): see https://github.com/nlohmann/json/issues/3077
ValueType ret;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
auto ret = ValueType();
JSONSerializer<ValueType>::from_json(*this, ret);
return ret;
}