Changeset 1199 for trunk


Ignore:
Timestamp:
Oct 4, 2010, 2:37:10 PM (10 years ago)
Author:
Peter Johansson
Message:

prefer operator+= rather than operator+

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Stats.cc

    r1194 r1199  
    175175  void Stats::calc_all(void)
    176176  {
    177     // FIXME: we should use operator+=
    178     SumVector init;
    179177    for (int lt=0; lt <= 4; ++lt) {
    180178      stats_[lt]["all"].clear();
    181       stats_[lt]["all"] =
    182         std::accumulate(stats_[lt].begin(),
    183                         stats_[lt].end(), init,
    184                         PairValuePlus<std::string, SumVector>());
    185     }
    186 
    187     comment_or_copy_stats()["all"] =
    188       comment_stats()["all"] + copyright_stats()["all"];
    189 
    190     total_stats()["all"] = code_stats()["all"] +
    191       comment_or_copy_stats()["all"] + other_stats()["all"];
     179      for (std::map<std::string, SumVector>::iterator i = stats_[lt].begin();
     180           i!=stats_[lt].end(); ++i) {
     181        stats_[lt]["all"] += i->second;
     182      }
     183    }
     184
     185    comment_or_copy_stats()["all"] = comment_stats()["all"];
     186    comment_or_copy_stats()["all"] += copyright_stats()["all"];
     187
     188    total_stats()["all"] = comment_or_copy_stats()["all"];
     189    total_stats()["all"] += code_stats()["all"];
     190    total_stats()["all"] += other_stats()["all"];
    192191  }
    193192
Note: See TracChangeset for help on using the changeset viewer.