Skip to content

Commit

Permalink
cleanup: Make use of types properly and make the loop a little more c…
Browse files Browse the repository at this point in the history
…lear.
  • Loading branch information
binkert committed Jun 6, 2009
1 parent c76a8b1 commit baa0d69
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/base/range_ops.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,27 @@

#ifndef __BASE_RANGE_OPS_HH__
#define __BASE_RANGE_OPS_HH__

#include <list>
#include <vector>

#include "base/range.hh"

template <class T>
inline void
FilterRangeList(std::vector<Range<T> > filter_list, std::list<Range<T> >
&range_list) {
typename std::list<Range<T> >::iterator i;
for (int x = 0; x < filter_list.size(); x++) {
for (i = range_list.begin(); i != range_list.end(); ) {
FilterRangeList(std::vector<Range<T> > filter_list,
std::list<Range<T> > &range_list)
{
typedef typename std::list<Range<T> > RangeList;

for (typename RangeList::size_type x = 0; x < filter_list.size(); x++) {
typename RangeList::iterator i = range_list.begin();
while (i != range_list.end()) {
// Is the range within one of our filter ranges?
if (filter_list[x] == i->start || filter_list[x] == i->end)
range_list.erase(i++);
i = range_list.erase(i);
else
i++;
++i;
}
}
}
Expand Down

0 comments on commit baa0d69

Please sign in to comment.