@@ -25,17 +25,26 @@ struct DatumSpec {
2525 size_t hash = 0 ;
2626 atype::type type = atype::NA;
2727
28- explicit DatumSpec (size_t index, atype::type type_) : datum{index}, type{type_} {}
29- explicit DatumSpec (LiteralNode::var_t literal, atype::type type_) : datum{literal}, type{type_} {}
30- explicit DatumSpec (std::string binding, size_t hash_, atype::type type_) : datum{binding}, hash{hash_}, type{type_} {}
28+ explicit constexpr DatumSpec (size_t index, atype::type type_) : datum{index}, type{type_} {}
29+ explicit constexpr DatumSpec (LiteralNode::var_t literal, atype::type type_) : datum{literal}, type{type_} {}
30+ explicit constexpr DatumSpec (std::string binding, size_t hash_, atype::type type_) : datum{binding}, hash{hash_}, type{type_} {}
3131 DatumSpec () = default ;
3232 DatumSpec (DatumSpec const &) = default ;
3333 DatumSpec (DatumSpec&&) = default ;
3434 DatumSpec& operator =(DatumSpec const &) = default ;
3535 DatumSpec& operator =(DatumSpec&&) = default ;
36- };
3736
38- bool operator ==(DatumSpec const & lhs, DatumSpec const & rhs);
37+ bool operator ==(DatumSpec const & rhs) const
38+ {
39+ bool eqValue = this ->datum == rhs.datum ;
40+ bool eqHash = true ;
41+ if (this ->datum .index () == 3 && eqValue) {
42+ eqHash = this ->hash == rhs.hash ;
43+ }
44+ bool eqType = this ->type == rhs.type ;
45+ return eqValue && eqHash && eqType;
46+ }
47+ };
3948
4049std::ostream& operator <<(std::ostream& os, DatumSpec const & spec);
4150
0 commit comments