Basic information about TArray, TSet and TMap containers

Oct, 2 2021— #basic

TArray

TArray is analogous to std::vector. It can store a sequence of elements of the same type, which has its own mutable order. It has not impressive performance in terms of speed, but internally lightweight.

TSet

TSet is similar to TArray, but it contains unique elements and represents elements at the same time as keys. This allows a constant speed to be achieved for most operations.

TMap

TMap is similar to TArray, but it contains unique elements and can take different types of variables as keys. The important information is that TMap differs from std::map by hashing not a key, but a key-value pair. Therefore, there is a big difference in performance in favor of TMap, since all operations take place in constant time (unlike std::map, where operations related to lookup by value take linear time).

Containers time complexity

Containers time complexity

By Georgy Treshchev

Unreal Engine Developer. Contact for any questions. Telegram chat, e-mail, Github.