208 - 问,C++CX:类型系统:数组

208 - 问,C++CX:类型系统:数组

The Platform::Array type is neither as efficient nor as powerful as std::vector, so as a general guideline you should avoid its use in internal code that performs lots of operations on the array elements.

At the Windows Runtime application binary interface (ABI) level

PassArray

Used when the caller passes an array to a method. The C++ input parameter type is const Platform::Array<T>.

FillArray

Used when the caller passes an array for the method to fill. The C++ input parameter type is Platform::WriteOnlyArray<T>.

ReceiveArray

Used when the caller receives an array that the method allocates. In C++/CX you can return the array in the return value as an Array^ or you can return it as an out parameter as type Array^*.

Platform::ArrayReference

Avoid exposing an Array as a property

In general, you should avoid exposing a Platform::Array^ as a property in a ref class because the entire array is returned even when client code is only attempting to access a single element. When you need to expose a sequence container as a property in a public ref class, Windows::Foundation::IVector is a better choice. In private or internal APIs (which are not published to metadata), consider using a standard C++ container such as std::vector.

参考资料

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh700131.aspx

你可能感兴趣的:(208 - 问,C++CX:类型系统:数组)