make_disjoint: Remove dead code

This commit is contained in:
Justin Viiret 2015-12-15 10:10:59 +11:00 committed by Matthew Barr
parent db4176c13e
commit 8069e99bee

View File

@ -29,43 +29,11 @@
#ifndef CHARREACH_UTIL_H
#define CHARREACH_UTIL_H
#include <map>
#include <set>
#include "charreach.h"
#include "ue2common.h"
namespace ue2 {
template<typename T>
std::map<CharReach, std::set<T> >
make_disjoint(const std::map<CharReach, std::set<T> > &in) {
using namespace std;
map<u8, set<T> > by_char;
for (typename map<CharReach, set<T> >::const_iterator it = in.begin();
it != in.end(); ++it) {
const CharReach &cr = it->first;
for (size_t j = cr.find_first(); j != CharReach::npos;
j = cr.find_next(j)) {
by_char[j].insert(it->second.begin(), it->second.end());
}
}
map<set<T>, CharReach> rev;
for (typename map<u8, set<T> >::const_iterator it = by_char.begin();
it != by_char.end(); ++it) {
rev[it->second].set(it->first);
}
map<CharReach, set<T> > out;
for (typename map<set<T>, CharReach>::const_iterator it = rev.begin();
it != rev.end(); ++it) {
assert(out.find(it->second) == out.end());
out[it->second] = it->first;
}
return out;
}
class CharReach;
void make_caseless(CharReach *cr);