mirror of
https://github.com/nlohmann/json.git
synced 2026-10-07 23:17:14 +00:00
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:
1 parent
d223021995
commit
deec1d0a67
1 file changed
+1
-1
@@ -145,7 +145,7 @@ TEST_CASE("hash<nlohmann::json>")
|
|||||||
CHECK(std::hash<json> {}(json(-1)) == std::hash<json> {}(json(-1.0)));
|
CHECK(std::hash<json> {}(json(-1)) == std::hash<json> {}(json(-1.0)));
|
||||||
|
|
||||||
// a std::unordered_set relies on this same consistency between == and hash
|
// 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);
|
CHECK(numbers.size() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user