Changeset 3801


Ignore:
Timestamp:
May 4, 2019, 9:47:28 AM (4 months ago)
Author:
Peter
Message:

implement reverse iterator in Pileup. closes #919

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/pileup.cc

    r3439 r3801  
    156156    ++count;
    157157  }
     158  Pileup<BamReadIterator>::const_reverse_iterator rend = pileup.rend();
     159  std::distance(pileup.rbegin(), rend);
    158160}
    159161
  • trunk/yat/omic/Pileup.h

    r3792 r3801  
    157157
    158158    /**
     159       Same as const_iterator but iterates reversed.
     160
     161       \see rbegin(void) rend(void)
     162
     163       \since new in yat 0.17
     164     */
     165    typedef typename std::list<Entry>::const_reverse_iterator
     166    const_reverse_iterator;
     167
     168    /**
    159169       Create an empty Pileup
    160170     */
     
    200210     */
    201211    void increment(void);
     212
     213    /**
     214       \return an iterator that points to the last Entry in Pileup.
     215
     216       Iteration is done in reversed order; othwerwise behaves as begin(void)
     217
     218       \since new in yat 0.17
     219     */
     220    const_reverse_iterator rbegin(void) const;
     221
     222    /**
     223       \return const reverse iterator to reverse end
     224
     225       \see end(void)
     226       \see rbegin(void)
     227
     228       \since new in yat 0.17
     229     */
     230    const_reverse_iterator rend(void) const;
    202231
    203232    /**
     
    262291
    263292  template<typename Iterator>
     293  typename Pileup<Iterator>::const_reverse_iterator
     294  Pileup<Iterator>::rbegin(void) const
     295  {
     296    return data_.rbegin();
     297  }
     298
     299
     300  template<typename Iterator>
    264301  typename Pileup<Iterator>::const_iterator Pileup<Iterator>::end(void) const
    265302  {
    266303    return data_.end();
     304  }
     305
     306
     307  template<typename Iterator>
     308  typename Pileup<Iterator>::const_reverse_iterator
     309  Pileup<Iterator>::rend(void) const
     310  {
     311    return data_.rend();
    267312  }
    268313
Note: See TracChangeset for help on using the changeset viewer.