Hi all,
trying to create a function in my .cpp like this:
void ASomeActor::SomeFunction(TArray<Room> roomList_)
{
//...
}
defined in the .h like this:
void SomeFunction(TArray<Room> roomList_);
in the constructor I have:
TArray<Room> roomList_;
and finally the function is called always inside the constructor like this:
SomeFunction(roomList_);
Can’t figure out the proper syntax to pass TArrays as arguments…
Hope someone can help.
Thanks in advance.
Bye
parallel forum post
Co
(Cø)
March 3, 2016, 11:13am
2
Hi,
i’m not sure what you Room class looks like but i’m pretty sure the compiler wants you to use pointers in your array
TArray<Room*> roomList_;
For optimization reason you should use a const ref when passing your array to a function (otherwise it will be duplicated for the call)
void SomeFunction(const TArray<Room*>& InRoomList);
Cø, you are the man! It appears to be working, it doesn’t return the information I would like it to (that’s another problem), but at least it compiles and executes properly now. I’m gonna tag as answered. Cheers mate!