c++ - CComSafeArray : Are Indices Really Reversed for MultiDimSetAt and MultiDimGetAt?

标签 c++ visual-studio com visual-c++ atl

MSDN documentation for CComSafeArray::MultiDimSetAt , alIndex 记录如下:

Pointer to a vector of indexes for each dimension in the array. The rightmost (least significant) dimension is alIndex[0].

documentation for CComSafeArray::MultiDimGetAt , alIndex 的记录不同:

Pointer to a vector of indexes for each dimension in the array. The leftmost (most significant) dimension is alIndex[0].

这让我想到,要获得相同的元素,需要颠倒多维数组中索引的顺序。但是,我没有发现实际情况如此。

我是不是误用了这个接口(interface)并走运,误解了文档,或者这可能是文档中的错误?

最佳答案

这似乎是文档错误 - 我建议您引用 SafeArrayGetElement/SafeArrayPutElement 文档,因为它似乎更准确。

要设置和获取相同的元素,您应该使用相同的索引数组(无需反转)。

顺便说一下,收获不错!

关于c++ - CComSafeArray : Are Indices Really Reversed for MultiDimSetAt and MultiDimGetAt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2329574/

相关文章:

python - c++&python关闭和打开不同dll中的文件

c# - 'Newtonsoft.Json.. .' exists in both ' Blend\Newtonsoft.Json.dll' 和 'Solution\packages\...\

visual-studio - 调试-使用断点跳过代码

c++ MFC compile error "C2470: ' CMySink' : looks like a function definition, but there is no parameter list;跳过明显的 body ”

c# - 在 Silverlight 4 中使用 ComAutomationFactory 遍历 Word 文档字段

c++ - 使用 fscanf 读取双倍

c++ - 为什么使用 fopen 打开流并使用读/写(而不是 fread/fwrite)执行 I/O

c++ - 为什么这个乘法模板代码会导致溢出?

c++ - 如何在 Visual Studio 中设置 MPI 中的进程数?

c# - 为什么 regasm.exe 使用错误的 GUID 注册我的 C# 程序集?