Skip to content

Commit

Permalink
Use std::unordered_set::find instead of std::unordered_set::contains
Browse files Browse the repository at this point in the history
Summary:
changelog: [internal]

I'm looking into JS exceptions in React 18 on Android and I've noticed we use [std::unordered_set::contains]((https://en.cppreference.com/w/cpp/container/unordered_set/contains) that is only supported in C++20. I don't think this causes the exceptions but I would like to eliminate this option.

Reviewed By: javache

Differential Revision: D34547741

fbshipit-source-id: 6cffcff3366e7579a2c0e19bc01ffcb355b9ddb6
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Mar 3, 2022
1 parent 664f9b1 commit 8669277
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ void FabricMountingManager::executeMount(
bool revisionCheck =
noRevisionCheck || newChildShadowView.props->revision > 1;
bool allocationCheck =
!allocatedViewTags.contains(newChildShadowView.tag);
allocatedViewTags.find(newChildShadowView.tag) ==
allocatedViewTags.end();
bool shouldCreateView =
shouldRememberAllocatedViews_ ? allocationCheck : revisionCheck;
if (shouldCreateView) {
Expand Down Expand Up @@ -822,7 +823,7 @@ void FabricMountingManager::preallocateShadowView(
return;
}
auto &allocatedViews = allocatedViewsIterator->second;
if (allocatedViews.contains(shadowView.tag)) {
if (allocatedViews.find(shadowView.tag) != allocatedViews.end()) {
return;
}
allocatedViews.insert(shadowView.tag);
Expand Down

0 comments on commit 8669277

Please sign in to comment.