Convert TArray to TSet in c++

is there a more efficient way than looping through the array and adding each element to set? sorry might be a stupid question.

The only thing that comes to mind is to Reserve the number of array members on the set before you start getting them in with the loop.

this will result on the set not needing to resize itself when your array members are pushed into it,
on the minus side it will result in TSet being bigger than it potentially needs to be