Unreal Engine C++: TMap doc sheet

Cheat sheet to unreal's TMap and equivalence with std::map.

Basic

#include "Containers/Map.h"

std::map<K, T> TMap<K, T>
Insert a new unique element map[key] = value .Add(key, value)
Find by key std::map::const_iterator it;
it = map.find( key );

// Test if found:
it != map.end();
T* value = map.Find(key)


// Test if found:
value != nullptr;
Find or add a default value.
i.e. value == T() if key does not exists.
T& value = map[ key ]; T& value = map.FindOrAdd(key)
Number of elements .size() .Num()
Check (size == 0) / (Num == 0)
.empty() .IsEmpty()
Set number of elements to 0
.clear() .Empty()
// Keep allocated memory
.Reset()
Pre-allocate memory None .Reserve(int size)




Advanced

std::map<K, T> TMap<K, T>
Remove element which matches 'key' .erase(key) .Remove(key)




Links

TMap<> API reference

No comments

(optional field, I won't disclose or spam but it's necessary to notify you if I respond to your comment)
All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Anti-spam question: