Announcement

Collapse
No announcement yet.

Mistakes in documentation

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [LEARNING RESOURCES] Mistakes in documentation

    I've just found a few mistakes in Coding Standard page https://docs.unrealengine.com/en-us/...CodingStandard
    I'm talking about this

    Code:
        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
    Code:
    *Kvp.Key, Kvp.Value
    And the second is - should we use
    Code:
    const TPair<FString, int32>& Kvp
    as explained in "Const Correctness" section?

    #2
    Thank you! We're fixing the "*" placement. The "const" usage could be better, though it's not needed to illustrate the concept we're discussing in that section, and it's only because our sample code happens not to do anything non-const. We could also use CreateConstIterator() in the "auto" portion to keep things similar.

    Comment

    Working...
    X