Ignore:
Timestamp:
Jul 8, 2010, 9:39:42 PM (12 years ago)
Author:
Peter
Message:

class SegmentSet?: added function clear and fixed bug in insert. Divided test into subtests. refs #635

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/SegmentSet.h

    r2292 r2296  
    7878     */
    7979    iterator begin(void) { return set_.begin(); }
     80
     81    /**
     82       \brief erases all the segments
     83     */
     84    void clear(void) { set_.clear(); }
    8085
    8186    /**
     
    216221  SegmentSet<T, Compare>::insert(const value_type& segment)
    217222  {
    218     iterator iter = set_.lower_bound(segment);
    219     return set_.insert(segment);
     223    std::pair<iterator, iterator> p = overlap_range(segment);
     224    std::pair<typename SegmentSet<T, Compare>::iterator, bool> result;
     225    if (p.first==p.second) {
     226      result.first = set_.insert(p.first, segment);
     227      result.second = true;
     228      return result;
     229    }
     230    result.first = p.first;
     231    result.second = false;
     232    return result;
    220233  }
    221234
Note: See TracChangeset for help on using the changeset viewer.