From 7de184dcc8963947155f3db35ff31e6e6b22aa47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 17 Apr 2024 07:10:06 +0000 Subject: [PATCH] codex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- foundations/ability/utils/include/json_builder.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/foundations/ability/utils/include/json_builder.h b/foundations/ability/utils/include/json_builder.h index c00d28af..5999df2e 100644 --- a/foundations/ability/utils/include/json_builder.h +++ b/foundations/ability/utils/include/json_builder.h @@ -69,13 +69,13 @@ public: JsonBuilder &Append(const std::string &key, const std::vector &valueList) { - std::vector::size_type valueListSize = valueList.size(); + constexpr size_t numOne = 1; if (!valueList.empty()) { JsonBuilder jsonArray; jsonArray.Append("["); - for (size_t i = 0; i < valueListSize; i++) { + for (size_t i = 0; i < valueList.size(); i++) { jsonArray.Append(valueList[i].ToJson()); - if (i != valueListSize - 1) { + if (i != valueList.size() - numOne) { jsonArray.Append(","); } } -- Gitee