views:

21

answers:

1

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 getting lucky, misunderstanding the documentation, or is this possibly an error in the docs?

+1  A: 

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!

Andrey