From 93aabac6efa51425e6d9e0d5e18927fc9e5c72a5 Mon Sep 17 00:00:00 2001 From: domsoll <76645975+domsoll@users.noreply.github.com> Date: Mon, 20 Sep 2021 16:19:47 +0200 Subject: [PATCH] STY: minor formatting cleanup --- include/nlohmann/detail/conversions/from_json.hpp | 3 +++ single_include/nlohmann/json.hpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp index f8ea2afd3..696b26a04 100644 --- a/include/nlohmann/detail/conversions/from_json.hpp +++ b/include/nlohmann/detail/conversions/from_json.hpp @@ -182,6 +182,7 @@ auto from_json(const BasicJsonType& j, T (&arr)[N]) // NOLINT(cppcoreguidelines- JSON_THROW(type_error::create(302, "array size must be " + std::to_string(N) + ", but is " + std::to_string(j.size()), j)); } #endif + for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); @@ -206,6 +207,7 @@ auto from_json_array_impl(const BasicJsonType& j, std::array& arr, JSON_THROW(type_error::create(302, "array size must be " + std::to_string(N) + ", but is " + std::to_string(j.size()), j)); } #endif + for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); @@ -289,6 +291,7 @@ std::array from_json_inplace_array_impl(BasicJsonType&& j, JSON_THROW(type_error::create(302, "array size must be " + std::to_string(sizeof...(Idx)) + ", but is " + std::to_string(j.size()), j)); } #endif + return { { std::forward(j).at(Idx).template get()... } }; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e2441ce35..a0391f2f6 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4053,6 +4053,7 @@ auto from_json(const BasicJsonType& j, T (&arr)[N]) // NOLINT(cppcoreguidelines- JSON_THROW(type_error::create(302, "array size must be " + std::to_string(N) + ", but is " + std::to_string(j.size()), j)); } #endif + for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); @@ -4077,6 +4078,7 @@ auto from_json_array_impl(const BasicJsonType& j, std::array& arr, JSON_THROW(type_error::create(302, "array size must be " + std::to_string(N) + ", but is " + std::to_string(j.size()), j)); } #endif + for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); @@ -4160,6 +4162,7 @@ std::array from_json_inplace_array_impl(BasicJsonType&& j, JSON_THROW(type_error::create(302, "array size must be " + std::to_string(sizeof...(Idx)) + ", but is " + std::to_string(j.size()), j)); } #endif + return { { std::forward(j).at(Idx).template get()... } }; } @@ -17663,7 +17666,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec detail::parser_callback_tcb = nullptr, const bool allow_exceptions = true, const bool ignore_comments = false - ) + ) { return ::nlohmann::detail::parser(std::move(adapter), std::move(cb), allow_exceptions, ignore_comments);