mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-18 18:20:35 +03:00
util: switch from Boost to std::unordered set/map
This commit replaces the ue2::unordered_{set,map} types with their STL
versions, with some new hashing utilities in util/hash.h. The new types
ue2_unordered_set<T> and ue2_unordered_map<Key, T> default to using the
ue2_hasher.
The header util/ue2_containers.h has been removed, and the flat_set/map
containers moved to util/flat_containers.h.
This commit is contained in:
committed by
Matthew Barr
parent
a425bb9b7c
commit
9cf66b6ac9
@@ -41,6 +41,7 @@
|
||||
#include "util/compile_context.h"
|
||||
#include "util/compile_error.h"
|
||||
#include "util/report_manager.h"
|
||||
#include "util/unordered.h"
|
||||
#include "util/verify_types.h"
|
||||
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
@@ -226,7 +227,7 @@ size_t RoseProgramHash::operator()(const RoseProgram &program) const {
|
||||
size_t v = 0;
|
||||
for (const auto &ri : program) {
|
||||
assert(ri);
|
||||
boost::hash_combine(v, ri->hash());
|
||||
hash_combine(v, ri->hash());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
@@ -1934,14 +1935,14 @@ void makeGroupSquashInstruction(const RoseBuildImpl &build, u32 lit_id,
|
||||
|
||||
namespace {
|
||||
struct ProgKey {
|
||||
ProgKey(const RoseProgram &p) : prog(&p) { }
|
||||
ProgKey(const RoseProgram &p) : prog(&p) {}
|
||||
|
||||
bool operator==(const ProgKey &b) const {
|
||||
return RoseProgramEquivalence()(*prog, *b.prog);
|
||||
}
|
||||
|
||||
friend size_t hash_value(const ProgKey &a) {
|
||||
return RoseProgramHash()(*a.prog);
|
||||
size_t hash() const {
|
||||
return RoseProgramHash()(*prog);
|
||||
}
|
||||
private:
|
||||
const RoseProgram *prog;
|
||||
@@ -1954,7 +1955,7 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
|
||||
vector<RoseProgram> blocks;
|
||||
blocks.reserve(blocks_in.size()); /* to ensure stable reference for seen */
|
||||
|
||||
unordered_set<ProgKey> seen;
|
||||
ue2_unordered_set<ProgKey> seen;
|
||||
for (auto &block : blocks_in) {
|
||||
if (contains(seen, block)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user