From ea0335f7c1308e61bfa4f83af0b6dff68a2b1bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 14 Jan 2017 17:38:35 +0100 Subject: [PATCH] Fix ChunkFile for std::set Without this, attempts to savestate std::set will fail with an error about dropping the const qualifier. leoetlino: I'll try to break it down: So, when you do a ranged-for on a container, it's essentially syntactic sugar over begin and end iterators. std::set is an associative container where the key type is the same as the value type, and so it's required that all iterator functions return constant iterators. If this wasn't a requirement, it would allow changing the ordering of elements from outside of the set's API (this is bad). --- Source/Core/Common/ChunkFile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h index 64e2a10b50..0fe2a81667 100644 --- a/Source/Core/Common/ChunkFile.h +++ b/Source/Core/Common/ChunkFile.h @@ -120,7 +120,7 @@ public: case MODE_WRITE: case MODE_MEASURE: case MODE_VERIFY: - for (V& val : x) + for (const V& val : x) { Do(val); }