Ignore:
Timestamp:
Nov 5, 2011, 12:03:50 AM (10 years ago)
Author:
Peter
Message:

fixes #680 and #679

File:
1 edited

Legend:

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

    r2610 r2611  
    121121
    122122    /**
     123       erase segments in range [first, last)
     124
     125       \since New in yat 0.8
     126     */
     127    void erase(iterator first, iterator last) { container_.erase(first, last);}
     128
     129    /**
     130       erase segment pointed to by \a pos
     131
     132       \since New in yat 0.8
     133     */
     134    void erase(iterator pos) { container_.erase(pos); }
     135
     136    /**
     137       \return an iterator pointing to the Segment that contains \a
     138       vt. If no Segment contains \a vt, end() is returned.
     139
     140       \since New in yat 0.8
     141     */
     142    iterator find(const element_type& vt);
     143
     144    /**
    123145       \return an iterator pointing to the Segment that contains \a
    124146       vt. If no Segment contains \a vt, end() is returned.
     
    233255
    234256
     257  template<class Container, class Compare, class Value2Key>
     258  typename SegmentTree<Container, Compare, Value2Key>::iterator
     259  SegmentTree<Container, Compare, Value2Key>::find(const element_type& vt)
     260  {
     261    iterator iter = lower_bound(vt);
     262    element_compare comp;
     263    if (iter==end() || comp(vt, Value2Key()(*iter).begin()))
     264      return end();
     265    return iter;
     266  }
     267
     268
    235269  template<typename T, class Compare, class Value2Key>
    236270  std::pair<typename SegmentTree<T, Compare, Value2Key>::iterator, bool>
Note: See TracChangeset for help on using the changeset viewer.