[C++] Workaround for MSVC 2010 for the issue with std::vector and explicitly aligned custom data types Part 2

This commit is contained in:
Alexey Geraskin
2019-07-17 18:18:13 +03:00
parent 9522970c5d
commit e059dcaa58

View File

@@ -1,5 +1,15 @@
#include "vector3d_pack.h"
// looks like VS10 does not support std::vector with explicit alignment
// From stackoverflow (https://stackoverflow.com/questions/8456236/how-is-a-vectors-data-aligned):
//
// Visual C++ version 2010 will not work with an std::vector with classes whose alignment are specified.
// The reason is std::vector::resize.
// When compiling, next error appears:
// c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector(870): error C2719:
// '_Val': formal parameter with __declspec(align('8')) won't be aligned [C:\projects\flatbuffers\flattests.vcxproj]
#if !defined(_MSC_VER) || _MSC_VER >= 1700
#include "native_type_test_generated.h"
namespace flatbuffers {
@@ -11,3 +21,5 @@ namespace flatbuffers {
return Native::Vector3D(obj.x(), obj.y(), obj.z());
}
}
#endif