From b1e8be27a9544b525a94612f9edbe00e306c07c4 Mon Sep 17 00:00:00 2001 From: James Swift Date: Tue, 24 May 2016 17:16:03 +0200 Subject: [PATCH] MSVC doesn't allow alignment on function params. This prevents the copy and thus avoids this issue https://msdn.microsoft.com/en-us/library/373ak2y1.aspx --- include/flatbuffers/flatbuffers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 0fa31250f..ef4a693cc 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -333,7 +333,7 @@ public: // Change elements if you have a non-const pointer to this object. // Scalars only. See reflection.h, and the documentation. - void Mutate(uoffset_t i, T val) { + void Mutate(uoffset_t i, const T& val) { assert(i < size()); WriteScalar(data() + i, val); }