cleanup: Make use of types properly and make the loop a little more clear.
This commit is contained in:
parent
c76a8b1c15
commit
baa0d695b2
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#ifndef __BASE_RANGE_OPS_HH__
|
#ifndef __BASE_RANGE_OPS_HH__
|
||||||
#define __BASE_RANGE_OPS_HH__
|
#define __BASE_RANGE_OPS_HH__
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -37,16 +38,19 @@
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void
|
inline void
|
||||||
FilterRangeList(std::vector<Range<T> > filter_list, std::list<Range<T> >
|
FilterRangeList(std::vector<Range<T> > filter_list,
|
||||||
&range_list) {
|
std::list<Range<T> > &range_list)
|
||||||
typename std::list<Range<T> >::iterator i;
|
{
|
||||||
for (int x = 0; x < filter_list.size(); x++) {
|
typedef typename std::list<Range<T> > RangeList;
|
||||||
for (i = range_list.begin(); i != range_list.end(); ) {
|
|
||||||
|
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?
|
// Is the range within one of our filter ranges?
|
||||||
if (filter_list[x] == i->start || filter_list[x] == i->end)
|
if (filter_list[x] == i->start || filter_list[x] == i->end)
|
||||||
range_list.erase(i++);
|
i = range_list.erase(i);
|
||||||
else
|
else
|
||||||
i++;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue