Is it possible to use TArray instead of Array in C++?

I’m adding a feature to the game where it chooses a random word from an array of word. To do that, I use this:

FString FBullCowGame::SelectRandomIsogram()
{
    const FString POSSIBLE_ISOGRAMS[10] = { "planet", "sun", "orgasm", "duck", "block", "same", "dance", "father", "flower", "two" };

    return POSSIBLE_ISOGRAMS[rand() % (POSSIBLE_ISOGRAMS->length() - 1)];
}

My code works fine, but I know that Unreal will use TArray. I tried doing something similar to

#define TMap std::map

but TArray use TArray, but the array class of C++ doesn’t, so i don’t know if it’s possible to define TArray and use it has the Array class of C++?

1 Like

Privacy & Terms