Status: Accepted
Owner: ----
New issue 2545 by [email protected]: Possible emptiness check
inefficiency
http://code.google.com/p/lilypond/issues/detail?id=2545
As reported by Julien Nabet, cppcheck reports that a standard idiom used in
LilyPond to check for an empty vector may be inefficient.
Also, in one particular case, (lily/tie-engraver.cc), Julien claims a
different while contition (!= instead of <) would be better.
322 if (!wait && new_heads_to_tie.size ())
323 {
324 vector<Head_event_tuple>::iterator it = heads_to_tie_.begin ();
325 for (; it < heads_to_tie_.end (); it++)
326 report_unterminated_tie (*it);
327 heads_to_tie_.clear ();
328 }
I have attached a listing of the cppcheck output. Note that the line
numbers will change if the source files change, but the relevant lines can
be found by searching for "size ()"
Attachments:
emptiness.txt 6.3 KB