Changeset 940 for trunk/lib


Ignore:
Timestamp:
Dec 3, 2009, 6:24:56 AM (12 years ago)
Author:
Peter Johansson
Message:

fix potential problem with iterators become invalid after insertion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Colors.cc

    r939 r940  
    6666    typedef std::map<std::string, std::string> ACmap;
    6767    const ACmap& authcols=Configuration::instance().author_colors();
     68    // reserve sufficient size in vector here to avoid reallocation
     69    // and iterators being invalidated
     70    color_map_.reserve(color_map_.size()+authcols.size());
     71    next_color_=color_map_.begin();
    6872    for (ACmap::const_iterator i=authcols.begin(); i!=authcols.end(); i++) {
    6973      color c;
Note: See TracChangeset for help on using the changeset viewer.