Use std::unordered_set::find instead of std::unordered_set::contains

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
This commit is contained in:
Samuel Susla 2022-03-03 09:22:32 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 664f9b11ba
Коммит 8669277b3b
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -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) {
@ -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);