Fix clang-tidy misc-const-correctness in counted_iterator test

first/first2 are passed by value into json::parse/accept and never
mutated afterward in this scope, so clang-tidy correctly flags them as
const-able. Verified clean against the exact CI job (silkeh/clang:dev,
ci_clang_tidy target, C++20 compile command).

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-07-11 23:50:05 +02:00
parent 55a12ee212
commit 840a7cbc11
+2 -2
View File
@@ -220,12 +220,12 @@ TEST_CASE("Parse with std::counted_iterator and std::default_sentinel_t")
const std::string json_str = R"({"key":"value","array":[1,2,3]})";
const auto len = static_cast<std::iter_difference_t<iterator_type>>(json_str.size());
std::counted_iterator<iterator_type> first(json_str.begin(), len);
const std::counted_iterator<iterator_type> first(json_str.begin(), len);
const json j = json::parse(first, std::default_sentinel);
CHECK(j["key"] == "value");
CHECK(j["array"].size() == 3);
std::counted_iterator<iterator_type> first2(json_str.begin(), len);
const std::counted_iterator<iterator_type> first2(json_str.begin(), len);
CHECK(json::accept(first2, std::default_sentinel));
}
#endif