You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ECol extends TSTL containers and dispatches CollectionEvents. The CollectionEvents are dispatched when its container's elements are inserted, erased or changed. Detailed types of those CollectionEvents are:
Type
Means
Dispatched By
"insert"
Elements are inserted
Container.insert()
"erase"
Elements are erased
Container.erase()
"refresh"
Elements are changed
Container.swap(), Iterator.set, ...
In ECol, DequeCollection extends Deque to dispatch CollectionEvents. As you can see from the above, DequeCollection.swap() dispatches "refresh" typed CollectionEvent. If Deque.insert() keeps using Deque.swap(), DequeCollection.insert() will dispatch not only "insert", but also "refresh" typed CollectionEvent, which is not valid.
To avoid the bad situation, Deque.insert() should not call Deque.swap() directly.
The text was updated successfully, but these errors were encountered:
Summary
Deque.insert()
does not callDeque.swap()
Deque.insert()
calls theDeque.swap()
Code occuring the bug
tstl/src/container/Deque.ts
Lines 457 to 463 in 816b9ea
Detailed Story
ECol extends TSTL containers and dispatches
CollectionEvent
s. TheCollectionEvent
s are dispatched when its container's elements are inserted, erased or changed. Detailed types of thoseCollectionEvent
s are:"insert"
Container.insert()
"erase"
Container.erase()
"refresh"
Container.swap()
,Iterator.set
, ...In ECol,
DequeCollection
extendsDeque
to dispatchCollectionEvent
s. As you can see from the above,DequeCollection.swap()
dispatches"refresh"
typedCollectionEvent
. IfDeque.insert()
keeps usingDeque.swap()
,DequeCollection.insert()
will dispatch not only"insert"
, but also"refresh"
typedCollectionEvent
, which is not valid.To avoid the bad situation,
Deque.insert()
should not callDeque.swap()
directly.The text was updated successfully, but these errors were encountered: