Optimization: no need to loop the whole vector.

Gotta love the back call.
This commit is contained in:
Jason Felds
2013-05-04 12:03:00 -04:00
parent f5c877cbb6
commit fc2b198ce2
+4 -2
View File
@@ -428,8 +428,10 @@ bool ProfileManager::CreateLocalProfile( RString sName, RString &sProfileIDOut )
int iMaxProfileNumber = -1;
vector<RString> vs;
GetLocalProfileIDs( vs );
for (RString const &s : vs)
iMaxProfileNumber = std::stoi( s );
if (vs.size() > 0)
{
iMaxProfileNumber = std::stoi(vs.back());
}
int iProfileNumber = iMaxProfileNumber + 1;
RString sProfileID = ssprintf( "%08d", iProfileNumber );