Code Cleanup

- Just found out about std::vector::back, after all these years.
This commit is contained in:
Paul Beckingham 2011-06-07 00:48:00 -04:00
parent d83b2d5e36
commit 7c910e46be
3 changed files with 16 additions and 14 deletions

View file

@ -832,7 +832,7 @@ void Chart::calculateRates (std::vector <time_t>& sequence)
{
// If there are no current pending tasks, then it is meaningless to find
// rates or estimated completion date.
if (bars[sequence[sequence.size () - 1]].pending == 0)
if (bars[sequence.back ()].pending == 0)
return;
// Calculate how many items we have.
@ -936,7 +936,7 @@ void Chart::calculateRates (std::vector <time_t>& sequence)
// Estimate completion
if (fix_rate > find_rate)
{
int current_pending = bars[sequence[sequence.size () - 1]].pending;
int current_pending = bars[sequence.back ()].pending;
int remaining_days = (int) (current_pending / (fix_rate - find_rate));
Date now;

View file

@ -235,7 +235,7 @@ std::string CmdImport::task_1_4_3 (const std::vector <std::string>& lines)
if (fields[f][0] != '\'' &&
fields[f][fields[f].length () - 1] == '\'')
{
modified[modified.size () - 1] += "," + fields[f];
modified.back () += "," + fields[f];
}
else
@ -391,7 +391,7 @@ std::string CmdImport::task_1_5_0 (const std::vector <std::string>& lines)
if (fields[f][0] != '\'' &&
fields[f][fields[f].length () - 1] == '\'')
{
modified[modified.size () - 1] += "," + fields[f];
modified.back () += "," + fields[f];
}
else
@ -552,7 +552,7 @@ std::string CmdImport::task_1_6_0 (const std::vector <std::string>& lines)
if (fields[f][0] != '\'' &&
fields[f][fields[f].length () - 1] == '\'')
{
modified[modified.size () - 1] += "," + fields[f];
modified.back () += "," + fields[f];
}
else