Browse Source

Reserve the vector's initial capacity instead of size.

Yao Wei Tjong 姚伟忠 12 years ago
parent
commit
181351ef45
1 changed files with 2 additions and 1 deletions
  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
                     // 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)
                     {