CComSafeArray: Are Indices Really Reversed for MultiDimSetAt and MultiDimGetAt?
In the MSDN documentation for CComSafeArray::MultiDimSetAt, alIndex is documented as follows:
Pointer to a vector of indexes for each dimension in the array. The rightmost (least significant) dimension is alIndex[0].
In the documentation for CComSafeArray::MultiDimGetAt, alIndex is documented differently:
Pointer to a vector of indexes for each dimension in the array. The leftmost (most significant) dimension is alIndex[0].
This made me think that, to get to the same element, one would need to reverse the order of the indices in a multidimensional array. However, I have not found this to be the case in practice.
Am I misusing this interface and g开发者_高级运维etting lucky, misunderstanding the documentation, or is this possibly an error in the docs?
It seems to be docs error - I'd suggest you to refer to SafeArrayGetElement/SafeArrayPutElement documentation as it seems to be more accurate.
To set and get the same element you should use the same array of indices (without reversing).
By the way, nice catch!
精彩评论