Possible to make TArray point to existing allocated memory without copying?

k_a_s_s_k_a_s_s
Wed, 07 Apr 2021 08:59:27 +0000
C++

Dear Unreal Engine community!

Is it possible to make a TArray point to existing memory instead of allocating new memory?

For example, if there already exists some C-style array (i.e. uint8* SomeArray), and I know the number of elements, is there a way to make a TArray<uint8> of this length, and just use that pointer as the Data of the TArray? I would like to avoid copying memory an extra time, but I need this data to be a TArray type for some convenient things it offers.

Any help or advice would be appreciated. Thank you.

4 posts - 1 participant