本文介绍了错误C2719:'_Val“:用__declspec形式参数(对齐('16'))将不会被一致?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建 D3DXMATRIXA16 像这样一个向量:矢量< D3DXMATRIXA16>矩阵; 和正在错误:

这是为什么什么呢?

感谢您的帮助!

解决方案

这是一个的的那个的stl ::向量不能正确地包含对齐的数据,如D3DXMATRIXA16。一个海报钉扎的根源的(或至少一的他们):矢量::调整大小的声明价值传递一致的数据,而不是常引用。有几个解决方法是建议在该线程,最安全的幸福的完全丢弃STL ::矢量的。您可能还需要修复STL头自己,重新编译 - 这实际上可能会更容易比它的声音,但我没有这样做我自己。

编辑:链接现在破(感谢@大卫梅纳尔),这里的。

该问题已在VS2012RC - 这里有一个链接,相应的连接问题。原来这实际上是一个问题,在C ++标准本身,定格在2008年。

I'm trying to create a vector for D3DXMATRIXA16 like so: vector<D3DXMATRIXA16> matrices; and am getting the error:

Why is that exactly?

Thanks for any help!

解决方案

It is a known issue that stl::vector cannot properly contain aligned data, such as D3DXMATRIXA16. One poster pinned the root cause (or at least, one of them?): the declaration of vector::resize passes the aligned data by value, and not as const reference.Several workarounds were suggested in that thread, the safest being dropping stl::vector altogether. You might also want to fix the stl headers yourself and recompile - this actually may be easier than it sounds, but I haven't done so myself.

EDIT: links are now broken (thanks @David Menard), here's an alternative, more elaborate answer.

The issue is fixed in VS2012RC - here's a link to a corresponding connect issue. Turns out it was actually an issue in the C++ standard itself, fixed in 2008.

这篇关于错误C2719:'_Val“:用__declspec形式参数(对齐('16'))将不会被一致?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:59