问题描述
我正在尝试初始化一个 Vector<int>
(为了与 BepuPhysics 集成,但我认为它无关紧要)。
静态属性 System.Numerics.Vector<int>.Count
在我的系统上等于 8
,所以我手动初始化了一个 8 元素数组。
这是我的代码:
var handles = new []{1,2,3,4,5,6,7,8};
var vector = new System.Numerics.Vector<int>(handles);
我是否遗漏了一些明显的东西?提前致谢。
解决方法
我不知道为什么会发生这种情况的答案,但看起来 aghidini 是正确的 - 这是一个调试器问题,它只显示 Vector 实例的 4 个值。
看下面的实验:
,documentation for the constructor you're using 指定:
仅使用前 Count 个元素。
关于 Count
属性的 main documentation 是这样说的:
Vector 实例的数量是固定的,但其上限取决于 CPU 寄存器。
所以看起来您在 4 处达到了 CPU 寄存器限制。