diff --git a/Nodes.hpp b/Nodes.hpp index bcdcf7f..3d177de 100644 --- a/Nodes.hpp +++ b/Nodes.hpp @@ -486,21 +486,11 @@ bool operator==(const Module &a, const Module &b) { return (a.getName() == b.getName()) && (a.getType() == b.getType()); } -} // namespace - -namespace std { - -template<> -struct hash { - size_t operator ()(const monicelli::Module &e) const noexcept { - return std::hash()(e.getName()) ^ std::hash()(e.getType()); - } -}; - +static inline +size_t hash_value(const monicelli::Module &e) { + return std::hash()(e.getName()) ^ std::hash()(e.getType()); } -namespace monicelli { - class Program: public Emittable { public: virtual bool emit(Emitter *emitter) const { @@ -516,8 +506,7 @@ public: } void addModule(Module *m) { - modules.insert(std::move(*m)); - delete m; + modules.insert(m); } boost::optional getMain() const { @@ -528,14 +517,14 @@ public: return functions; } - std::unordered_set const& getModules() const { + PointerSet const& getModules() const { return modules; } private: Pointer main; PointerList functions; - std::unordered_set modules; + PointerSet modules; };