I want to copy a sequence of items in a Platform::Array object to another Platform::Array. I can of course solve this for example with a for loop:
int srcIdx = srcIdx0;
int destIdx = destIdx0;
for (int i = 0; i < count; ++i, ++srcIdx, ++destIdx)
dest[destIdx] = src[srcIdx];
What I am wondering is, is there some built-in functionality in C++/CX (Component Extensions) for performing this operation more efficiently and less verbose?
In C#, there is the Array.Copy method, and with C++/CLI Marshal.Copy would be an option at least for copying “primitive” types.
In C++ STL, there is std::copy and std::copy_n, but from what I can tell these algorithms do not work with Platform::Array “iterators” begin() and end().
Is there a C++/CX convenience copy method “hidden” somewhere, or do I have to fallback on explicit for loops for this operation?
At this point in time there seem to be no built-in
Platform::Arraycopy methods, so I have implemented my own template function for the purpose:Suggestions on how to improve the copying part are more than welcome 🙂