void cbn_consoleOutput(unordered_multimap<string, string> &folder) { std::cout << "Folder contains:"<<endl; for ( auto it = folder.begin(); it != folder.end(); ++it ){ std::cout << " " << it->first << ":" << it->second; std::cout << std::endl;} }
void eraseIf(unordered_multimap<K, V, H, E, A>& unordered, EraseIfFn const& f) { for (typename unordered_multimap<K, V, H, E, A>::iterator i = unordered.begin(), e = unordered.end(); i != e;) // no ++i - intentional if (f(*i)) i = unordered.erase(i); else ++i; }
void eraseIfVal(unordered_multimap<K, V, H, E, A>& umap, EraseIfFn const& f) { for (typename unordered_multimap<K, V, H, E, A>::iterator i = umap.begin(), e = umap.end(); i != e;) // no ++i - intentional if (f(i->second)) i = umap.erase(i); else ++i; }
void umm_buckets(unordered_multimap<string, string> &folder) { std::cout << "folder buckets contain:\n"; for ( unsigned i = 0; i < folder.bucket_count(); ++i) { std::cout << "bucket #" << i << " contains:"; for ( auto local_it = folder.begin(i); local_it!= folder.end(i); ++local_it ) std::cout << " " << local_it->first << ":" << local_it->second; std::cout << std::endl; } }
uint64_t sketchUnorderedComparisonError(const unordered_multimap<string, string>& map1, const unordered_multimap<string, string>& map2){ uint64_t res(0); string beg,end; for (auto it=map1.begin(); it!=map1.end(); ++it){ beg=it->first; end=it->second; auto ret = map2.equal_range(beg); for (auto it2=ret.first; it2!=ret.second; ++it2){ if(isCorrect(end,it2->second)){ ++res; } } } return res; }