I’ve just found a few mistakes in Coding Standard page Epic C++ Coding Standard for Unreal Engine | Unreal Engine 5.2 Documentation
I’m talking about this
TMap<FString, int32> MyMap;
// Old style
for (auto It = MyMap.CreateIterator(); It; ++It)
{
UE_LOG(LogCategory, Log, TEXT("Key: %s, Value: %d"), It.Key(), *It.Value());
}
// New style
for (TPair<FString, int32>& Kvp : MyMap)
{
UE_LOG(LogCategory, Log, TEXT("Key: %s, Value: %d"), Kvp.Key, *Kvp.Value);
}
But it’s of course is not compilable, it should be
*Kvp.Key, Kvp.Value
And the second is - should we use
const TPair<FString, int32>& Kvp
as explained in “Const Correctness” section?