Let's say I want to register multiple cleanup functions in an Iterator.
The first function will be in cleanuphead, the first place of linked list
The second function will be in cleanuphead.next, the second place of linked list, which is fine by now
But the third function will be in cleanuphead.next, the second place of linked list, so far and so forth, why do insertion always happens in the second place of linked list?
If I'm understanding it right: If we registered 4 cleanup functions like [A,B,C,D] , it will called in a sequence like [A, D, C, B]
I demonstrated it here :https://godbolt.org/z/Kf6YYfnKn
I've read some source code of Iterator and having this confusion about
Iterator::RegisterCleanup
Let's say I want to register multiple cleanup functions in an Iterator.
If I'm understanding it right: If we registered 4 cleanup functions like [A,B,C,D] , it will called in a sequence like [A, D, C, B] I demonstrated it here :https://godbolt.org/z/Kf6YYfnKn
what's the design thoughts here?