# Post increment (operator++) operator is not overridden for data structure iteration when iterator is created with \*.CreateConstIterator()

**URL:** <https://forums.unrealengine.com/t/post-increment-operator-operator-is-not-overridden-for-data-structure-iteration-when-iterator-is-created-with-createconstiterator/387548>\
**Category:** C++\
**Tags:** unreal-engine, bug-report, UE4, CPP, question\
**Created:** [March 10, 2017, 6:50pm UTC](https://forums.unrealengine.com/t/post-increment-operator-operator-is-not-overridden-for-data-structure-iteration-when-iterator-is-created-with-createconstiterator/387548 "2017-03-10T18:50:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matiati](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Matiati](https://forums.unrealengine.com/u/Matiati)\
**Post date:** [March 10, 2017, 6:50pm UTC](https://forums.unrealengine.com/t/post-increment-operator-operator-is-not-overridden-for-data-structure-iteration-when-iterator-is-created-with-createconstiterator/387548/1 "2017-03-10T18:50:40Z")

</div>

Probably a very simple matter and can be seen as unimportant. But I am an obsessed maniac so I had to write it :D.

When I like to iterate an Unreal data structure (i.e. a TMap, TSet etc.), I get a compile time error with the following code

```
for (auto i = someDT.CreateConstIterator(); i; i++) {
     foo(*i);
}

```

But it works if I pre-increment i

```
for (auto i = someDT.CreateConstIterator(); i; ++i) {
     foo(*i);
}

```

I’ve not tested it with all data structures but I can confirm that this happens with TMap. For non-const iterators created with “CreateIterator()” both versions work.

I am not sure if this is intentional but it seems like it is simply forgotten.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [March 21, 2017, 7:55pm UTC](https://forums.unrealengine.com/t/post-increment-operator-operator-is-not-overridden-for-data-structure-iteration-when-iterator-is-created-with-createconstiterator/387548/2 "2017-03-21T19:55:30Z")

</div>

Hey Matiati-

Thank you for submitting a bug report. I have reproduced this issue and logged a report for it here [Unreal Engine Issues and Bug Tracker (UE-43155)](https://issues.unrealengine.com/issue/UE-43155) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers

---

<div class="post-metadata">

**Author:** ![Elencrak](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Elencrak](https://forums.unrealengine.com/u/Elencrak)\
**Post date:** [September 6, 2017, 7:06pm UTC](https://forums.unrealengine.com/t/post-increment-operator-operator-is-not-overridden-for-data-structure-iteration-when-iterator-is-created-with-createconstiterator/387548/3 "2017-09-06T19:06:27Z")

</div>

I have the same issue if i use “CreateIterator()”.

I have vote to this issue. It’s not blocking issue but i lost few minute to find why the normal increment doesn’t work ?

With increment the project doesn’t compile

```
for (auto it = map.CreateIterator(); it; it++)
	{
		it->Value;
	}

```

With a pre increment it works

```
for (auto it = map.CreateIterator(); it; ++it)
{
	it->Value;
}

```

Engine version 4.15.3
