Changeset 1532 for trunk


Ignore:
Timestamp:
Sep 25, 2008, 12:06:47 AM (13 years ago)
Author:
Peter
Message:

refs #368 - const version is now working

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/iterator_test.cc

    r1531 r1532  
    412412  utility::WeightedIterator<Iter, Iter> iter(vec.begin(), vec.begin());
    413413
    414   test_input_iterator(iter, suite);
    415 
    416 }
     414  test_random_access_iterator(iter, suite);
     415
     416}
  • trunk/yat/utility/WeightedIterator.h

    r1531 r1532  
    2424
    2525#include <boost/iterator/iterator_facade.hpp>
     26
     27#include <iterator>
    2628
    2729namespace theplu {
     
    7173    WeightIterator w_iter_;
    7274
     75    void advance(size_t n)
     76    { std::advance(d_iter_, n); std::advance(w_iter_, n); }
     77
     78    void decrement(void) { --d_iter_; --w_iter_; }
     79
     80    typename std::iterator_traits<DataIterator>::difference_type
     81    distance_to(const WeightedIterator& other) const
     82    { return std::distance(d_iter_, other.d_iter_); }
     83
    7384    DataWeight dereference(void) const
    7485    { return DataWeight(*d_iter_, *w_iter_); }
     86
     87    bool equal(const WeightedIterator& other) const
     88    { return d_iter_==other.d_iter_ && w_iter_==other.w_iter_; }
    7589
    7690    void increment(void) { ++d_iter_; ++w_iter_; }
Note: See TracChangeset for help on using the changeset viewer.