Mark the unordered_set in the hash regression test const

clang-tidy's misc-const-correctness check flagged it: the set is
never mutated after construction, only read via size().

Signed-off-by: Afonso Januário <afonso-januario@hotmail.com>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Afonso Januário authored and Niels Lohmann committed 2026-10-06 22:51:42 +02:00
1 parent 23381929ff
commit 071f79b524
1 file changed
+1 -1
+1 -1
View File
@@ -145,7 +145,7 @@ TEST_CASE("hash<nlohmann::json>")
CHECK(std::hash<json> {}(json(-1)) == std::hash<json> {}(json(-1.0)));
// a std::unordered_set relies on this same consistency between == and hash
std::unordered_set<json> numbers {json(0), json(static_cast<unsigned>(0)), json(0.0)};
const std::unordered_set<json> numbers {json(0), json(static_cast<unsigned>(0)), json(0.0)};
CHECK(numbers.size() == 1);
}