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

QUESTION: should i hold iterator or pointer to element #55

Closed
LeGamerDc opened this issue Mar 6, 2025 · 1 comment
Closed

QUESTION: should i hold iterator or pointer to element #55

LeGamerDc opened this issue Mar 6, 2025 · 1 comment

Comments

@LeGamerDc
Copy link

Say i would like to keep a reference(iterator or pointer) to a element in somewhere,when i use it later, how would i know where it's still valid or invalid (like erased and then insert in same place?)

@mattreecebentley
Copy link
Owner

Use get_iterator if it's a pointer, use is_active if it's an iterator. This will only tell you if an element exists in that location, not if it's the same element. Use a unique id within the element if you want to guarantee that it's the same element. If you like you can create a wrapper around an iterator which stores the id and compares.
Please send questions over email, the issues format is only really for issues with the implementation, not for Q&A.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants