Example #1
0
 void next()
 {
     RANGES_ASSERT(cur_ != last_);
     // If the last match consumed zero elements, bump the position.
     advance_bounded(cur_, (int)zero_, last_);
     zero_ = false;
     for(; cur_ != last_; ++cur_)
     {
         std::pair<bool, range_difference_t<Rng>> p = fun_(cur_, last_);
         if(p.first)
         {
             advance(cur_, p.second);
             zero_ = (0 == p.second);
             return;
         }
     }
 }
Example #2
0
 void operator()(Rng & rng, range_difference_t<Rng> const step) const
 {
     RANGES_ASSERT(0 < step);
     if(1 < step)
     {
         I begin = ranges::begin(rng);
         S const end = ranges::end(rng);
         if(begin != end)
         {
             for(I i = next_bounded(++begin, step-1, end); i != end;
                 advance_bounded(i, step, end), ++begin)
             {
                 *begin = std::move(*i);
             }
         }
         ranges::action::erase(rng, begin, end);
     }
 }