Skip to content

Fix RBMap's, iterator-based, remove()#82797

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
RandomShaper:fix_rbmap
Oct 16, 2023
Merged

Fix RBMap's, iterator-based, remove()#82797
akien-mga merged 1 commit into
godotengine:masterfrom
RandomShaper:fix_rbmap

Conversation

@RandomShaper

Copy link
Copy Markdown
Member

RBMap::remove() needs to access private members of its Iterator, but there's no friendship between them, so it's broken.

This PR is here to save the day.


Test code:

	RBMap<int, int> rb_map;
	decltype(rb_map)::Iterator rb_it;
	rb_map.remove(rb_it);

MSVC error:

core/templates/rb_map.h(166): error C2248: 'RBMap<int,int,Comparator<K>,DefaultAllocator>::Iterator::E': cannot access private member declared in class 'RBMap<int,int,Comparator<K>,DefaultAllocator>::Iterator'

@akien-mga akien-mga merged commit 3bc1c9b into godotengine:master Oct 16, 2023
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

@RandomShaper RandomShaper deleted the fix_rbmap branch October 16, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants