Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port curve container types to std::deque #1637

Closed
wants to merge 2 commits into from

Conversation

heinezen
Copy link
Member

Same as #1635 but with deque.

@heinezen heinezen added improvement Enhancement of an existing component lang: c++ Done in C++ code code quality Does not alter behavior, but beauty of our code labels Apr 16, 2024
@heinezen heinezen requested a review from TheJJ April 16, 2024 22:34
@heinezen
Copy link
Member Author

Ah there might be a problem with iterator stablity:

std::deque:

insertion and deletion at either end of a deque never invalidates pointers or references to the rest of the elements.

erase(): All iterators and references are invalidated, unless the erased elements are at the end or at the beginning of the container, in which case only the iterators and references to the erased elements are invalidated. The end() iterator is also invalidated unless the erased elements are at the beginning of the container and the last element is not erased.

std::list:

Adding, removing and moving the elements within the list or across several lists does not invalidate the iterators or references. An iterator is invalidated only when the corresponding element is deleted.

So we cannot properly cache with std::deque if the erasure happens in the middle of the queue.

@heinezen heinezen force-pushed the feature/keyframe_deque branch from fb9569a to a602471 Compare April 17, 2024 00:02
@heinezen heinezen marked this pull request as draft April 17, 2024 00:25
@heinezen heinezen closed this Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Does not alter behavior, but beauty of our code improvement Enhancement of an existing component lang: c++ Done in C++ code
Projects
Development

Successfully merging this pull request may close these issues.

1 participant