Description

Attempting to use a post increment operator in a TMap or TSet iterator will fail to compile with error shown in callstack field. This is due to the post-increment operator not being overridden in Map.h. This is inconsistent with using a pre-increment operator which will compile/function as expected.

Regression:
No- same error message when attempting to use the code in 4.14.3 project

Steps to Reproduce
  1. Open UE4 Editor
  2. Add code to project based on Actor (MyActor)
  3. Add the following to MyActor.h
    	UPROPERTY(EditAnywhere, BlueprintReadWrite)
    		TMap<int32,int32> TestMap;
    
  4. Add the following to MyActor.cpp in the BeginPlay function
    for (auto i = TestMap.CreateConstIterator(); i; i++) {}
    
  5. Compile

Result:
Compile will fail with error shown in callstack field

Expected:
Post increment is overridden and can be used/compiled

Callstack

error C2676: binary '++': 'TMapBase<KeyType,ValueType,SetAllocator,KeyFuncs>::TConstIterator' does not define this operator or a conversion to a type acceptable to the predefined operator

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

2
Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.14.34.15.14.20
CreatedMar 21, 2017
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue