List container (Not Array)

Hi. I’m looking for the List container in Blueprint like std::list<> in C++. The basic features should be: add/remove element to the container should be with complexity O(1). Is there one available?

You can use TLinkedList. Linked lists have constant add/remove time.
The wiki page also mentions that it has constant access time, so that’s cool.

All the templated container types available in Unreal by default are located in Engine/Source/Runtime/Core/Public/Containers. I don’t know the exact needs for the container type that you havae, but of particular interest for your use case might be List.h types such as TList, TLinkedList, TDoubleLinkedList, with and Map.h types such as TMap, TSortableMapBase, TMultiMap.

1 Like

Thanks! Are these containers in the blueprint nodes?

Oh I completely missed that part. No- there are only 4 containers in unreal.
image
But if you’re caring about about constant modify time, you’ll probably want to put whatever is doing that in C++ anyways.

You could also create a linked list in c++ and create blueprint callable modifier & access methods for it if you really want it in blueprint.

1 Like

One more question. How blueprint array is built from the inside? Is that an array like in C++ or smth more complicated?

As far as I know, the blueprint array is just a TArray<>, and that seems pretty normal.
Though TArray<> is 3567 lines long, so I can’t say with 100% certainty.

1 Like

Anyway. Thank you!

1 Like