mirror of https://github.com/AxioDL/amuse.git
Add some reserve() calls
This commit is contained in:
parent
df167556fb
commit
2836e73812
|
@ -82,6 +82,7 @@ DirectoryEnumerator::DirectoryEnumerator(const SystemChar* path, Mode mode, bool
|
||||||
sort.emplace(std::make_pair(d.cFileName, Entry(std::move(fp), d.cFileName, 0, true)));
|
sort.emplace(std::make_pair(d.cFileName, Entry(std::move(fp), d.cFileName, 0, true)));
|
||||||
} while (FindNextFileW(dir, &d));
|
} while (FindNextFileW(dir, &d));
|
||||||
|
|
||||||
|
m_entries.reserve(sort.size());
|
||||||
if (reverse)
|
if (reverse)
|
||||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
||||||
m_entries.push_back(std::move(it->second));
|
m_entries.push_back(std::move(it->second));
|
||||||
|
@ -117,6 +118,7 @@ DirectoryEnumerator::DirectoryEnumerator(const SystemChar* path, Mode mode, bool
|
||||||
sort.emplace(std::make_pair(st.st_size, Entry(std::move(fp), d.cFileName, st.st_size, false)));
|
sort.emplace(std::make_pair(st.st_size, Entry(std::move(fp), d.cFileName, st.st_size, false)));
|
||||||
} while (FindNextFileW(dir, &d));
|
} while (FindNextFileW(dir, &d));
|
||||||
|
|
||||||
|
m_entries.reserve(sort.size());
|
||||||
if (reverse)
|
if (reverse)
|
||||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
||||||
m_entries.push_back(std::move(it->second));
|
m_entries.push_back(std::move(it->second));
|
||||||
|
@ -142,6 +144,7 @@ DirectoryEnumerator::DirectoryEnumerator(const SystemChar* path, Mode mode, bool
|
||||||
sort.emplace(std::make_pair(d.cFileName, Entry(std::move(fp), d.cFileName, st.st_size, false)));
|
sort.emplace(std::make_pair(d.cFileName, Entry(std::move(fp), d.cFileName, st.st_size, false)));
|
||||||
} while (FindNextFileW(dir, &d));
|
} while (FindNextFileW(dir, &d));
|
||||||
|
|
||||||
|
m_entries.reserve(sort.size());
|
||||||
if (reverse)
|
if (reverse)
|
||||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
||||||
m_entries.push_back(std::move(it->second));
|
m_entries.push_back(std::move(it->second));
|
||||||
|
@ -208,6 +211,7 @@ DirectoryEnumerator::DirectoryEnumerator(const SystemChar* path, Mode mode, bool
|
||||||
sort.emplace(std::make_pair(d->d_name, Entry(std::move(fp), d->d_name, 0, true)));
|
sort.emplace(std::make_pair(d->d_name, Entry(std::move(fp), d->d_name, 0, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_entries.reserve(sort.size());
|
||||||
if (reverse)
|
if (reverse)
|
||||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
||||||
m_entries.push_back(std::move(it->second));
|
m_entries.push_back(std::move(it->second));
|
||||||
|
@ -242,6 +246,7 @@ DirectoryEnumerator::DirectoryEnumerator(const SystemChar* path, Mode mode, bool
|
||||||
sort.emplace(std::make_pair(st.st_size, Entry(std::move(fp), d->d_name, st.st_size, false)));
|
sort.emplace(std::make_pair(st.st_size, Entry(std::move(fp), d->d_name, st.st_size, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_entries.reserve(sort.size());
|
||||||
if (reverse)
|
if (reverse)
|
||||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
||||||
m_entries.push_back(std::move(it->second));
|
m_entries.push_back(std::move(it->second));
|
||||||
|
@ -267,6 +272,7 @@ DirectoryEnumerator::DirectoryEnumerator(const SystemChar* path, Mode mode, bool
|
||||||
sort.emplace(std::make_pair(d->d_name, Entry(std::move(fp), d->d_name, st.st_size, false)));
|
sort.emplace(std::make_pair(d->d_name, Entry(std::move(fp), d->d_name, st.st_size, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_entries.reserve(sort.size());
|
||||||
if (reverse)
|
if (reverse)
|
||||||
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
for (auto it = sort.crbegin(); it != sort.crend(); ++it)
|
||||||
m_entries.push_back(std::move(it->second));
|
m_entries.push_back(std::move(it->second));
|
||||||
|
|
Loading…
Reference in New Issue