Use pre-increment for iterators instead of post-increment.

Pre-increment is more efficient, since it doesn't have to return the
old iterator.
This commit is contained in:
David Korth 2019-09-14 16:48:48 -04:00
parent c2dd2e8a2e
commit f5fe692842
3 changed files with 4 additions and 4 deletions

View File

@ -76,7 +76,7 @@ std::vector<ResourcePack>& GetPacks()
std::vector<ResourcePack*> GetLowerPriorityPacks(ResourcePack& pack)
{
std::vector<ResourcePack*> list;
for (auto it = std::find(packs.begin(), packs.end(), pack) + 1; it != packs.end(); it++)
for (auto it = std::find(packs.begin(), packs.end(), pack) + 1; it != packs.end(); ++it)
{
auto& entry = *it;
if (!IsInstalled(pack))
@ -93,7 +93,7 @@ std::vector<ResourcePack*> GetHigherPriorityPacks(ResourcePack& pack)
std::vector<ResourcePack*> list;
auto end = std::find(packs.begin(), packs.end(), pack);
for (auto it = packs.begin(); it != end; it++)
for (auto it = packs.begin(); it != end; ++it)
{
auto& entry = *it;
if (!IsInstalled(entry))

View File

@ -178,7 +178,7 @@ bool StreamBuffer::WaitForClearSpace(u32 num_bytes)
u32 new_gpu_position = 0;
auto iter = m_tracked_fences.begin();
for (; iter != m_tracked_fences.end(); iter++)
for (; iter != m_tracked_fences.end(); ++iter)
{
// Would this fence bring us in line with the GPU?
// This is the "last resort" case, where a command buffer execution has been forced

View File

@ -254,7 +254,7 @@ bool StreamBuffer::WaitForClearSpace(u32 num_bytes)
u32 new_gpu_position = 0;
auto iter = m_tracked_fences.begin();
for (; iter != m_tracked_fences.end(); iter++)
for (; iter != m_tracked_fences.end(); ++iter)
{
// Would this fence bring us in line with the GPU?
// This is the "last resort" case, where a command buffer execution has been forced