Advertisement
Developer_Bastian

Unreal Engine - Search in TMap via Predicate

Jan 10th, 2024
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | Gaming | 0 0
  1. // Best way to search in an Unreal TMap<FName, Struct[FConnectionInfo]>
  2. // FilterByPredicate will create a subset of a TMap with the filter applied
  3. // Predicate filter signature is the same as Map - "<FName, FConnectionInfo>" in this example
  4. // Predicate is a function that returns a bool
  5. // Predicate can access the entries of the map via Key (name) / Value (struct in this case)
  6.  
  7. TMap<FName, FConnectionInfo> tmpMap = ConnectionsMap.FilterByPredicate([](const TPair<FName, FConnectionInfo>& KvP)
  8.     { return KvP.Value.ConnectionUserName.Equals("Test") == true; });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement