Ver Fonte

Reserve the vector's initial capacity instead of size.

Yao Wei Tjong 姚伟忠 há 12 anos atrás
pai
commit
181351ef45
1 ficheiros alterados com 2 adições e 1 exclusões
  1. 2 1
      Source/Engine/Resource/ResourceCache.cpp

+ 2 - 1
Source/Engine/Resource/ResourceCache.cpp

@@ -764,7 +764,8 @@ void ResourceCache::HandleBeginFrame(StringHash eventType, VariantMap& eventData
                 {
                 {
                     // Reloading a resource may modify the dependency tracking structure. Therefore collect the
                     // Reloading a resource may modify the dependency tracking structure. Therefore collect the
                     // resources we need to reload first
                     // resources we need to reload first
-                    Vector<SharedPtr<Resource> > dependents(j->second_.Size());
+                    Vector<SharedPtr<Resource> > dependents;
+                    dependents.Reserve(j->second_.Size());
                     
                     
                     for (HashSet<StringHash>::ConstIterator k = j->second_.Begin(); k != j->second_.End(); ++k)
                     for (HashSet<StringHash>::ConstIterator k = j->second_.Begin(); k != j->second_.End(); ++k)
                     {
                     {