Changeset 1205 for trunk


Ignore:
Timestamp:
Oct 6, 2010, 1:31:51 AM (11 years ago)
Author:
Peter Johansson
Message:

avoid copying. use max_element instead of back() so plot_summary also can be used in sub-classes for which this is not equivalent (see impl max_element)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Stats.cc

    r1203 r1205  
    511511  {
    512512    Graph gp(filename+"."+format, format);
    513     // FIXME: why not const&
    514     SumVector total = get_vector(total_stats(), "all");
    515     double yrange_max=1.03*total.back()+1;
     513    const SumVector& total = get_vector(total_stats(), "all");
     514    double yrange_max=1.03*max_element(total)+1;
    516515    gp.ymax(yrange_max);
    517516   
    518     // FIXME: why not const&
    519     SumVector x(get_vector(code_stats(), "all"));
     517    const SumVector& x(get_vector(code_stats(), "all"));
    520518    gp.current_color(255,255,0);
    521519    gp.plot(x, "code", x.back());
    522520
    523     x = get_vector(comment_or_copy_stats(), "all");
     521    const SumVector& y = get_vector(comment_or_copy_stats(), "all");
    524522    gp.current_color(0,0,255);
    525     gp.plot(x, "comment", x.back());
    526 
    527     x = get_vector(other_stats(), "all");
     523    gp.plot(y, "comment", y.back());
     524
     525    const SumVector& z = get_vector(comment_or_copy_stats(), "all");
    528526    gp.current_color(0,255,0);
    529     gp.plot(x, "other", x.back());
     527    gp.plot(z, "other", z.back());
    530528
    531529    gp.current_color(255,0,0);
Note: See TracChangeset for help on using the changeset viewer.