소스 검색

fixup! hle: kernel: Add initial impl. of KAutoObjectWithListContainer.

bunnei 5 년 전
부모
커밋
51aa5a5364
1개의 변경된 파일2개의 추가작업 그리고 9개의 파일을 삭제
  1. 2 9
      src/core/hle/kernel/k_auto_object_container.cpp

+ 2 - 9
src/core/hle/kernel/k_auto_object_container.cpp

@@ -21,15 +21,8 @@ void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) {
 size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) {
 size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) {
     KScopedLightLock lk(m_lock);
     KScopedLightLock lk(m_lock);
 
 
-    size_t count = 0;
-
-    for (auto& obj : m_object_list) {
-        if (obj.GetOwner() == owner) {
-            count++;
-        }
-    }
-
-    return count;
+    return std::count_if(m_object_list.begin(), m_object_list.end(),
+                         [&](const auto& obj) { return obj.GetOwner() == owner; });
 }
 }
 
 
 } // namespace Kernel
 } // namespace Kernel