Is it possible to convert byte* to Array^ in C++/CX?
Currently I accomplish this by copying each value, which I know is not space/performance efficient.
My current implementation is :
Array<byte>^ arr = ref new Array<byte>(byteCount);
for (int i = 0; i < byteCount; i++)
{
arr[i] = *(bytes + i);
}
There's an array constructor for that (MSDN):
Array(T* data, unsigned int size);
So in your case, simply do:
Array<byte>^ arr = ref new Array<byte>(bytes, byteCount);
This is a great article on C++/CX and WinRT array patterns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With