Fix: fix equality operator for fields
Instead of comparing the referenced field node by pointer, compare the nodes directly instead. This is important because different field nodes might be the same semantically.
This commit is contained in:
@@ -151,12 +151,14 @@ template<typename NodePtr> class GFieldBase {
|
||||
|
||||
friend bool operator==(const GFieldBase &a, const GFieldBase &b)
|
||||
{
|
||||
return &*a.node_ == &*b.node_ && a.node_output_index_ == b.node_output_index_;
|
||||
/* Two nodes can compare equal even when their pointer is not the same. For example, two
|
||||
* "Position" nodes are the same. */
|
||||
return *a.node_ == *b.node_ && a.node_output_index_ == b.node_output_index_;
|
||||
}
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
return get_default_hash_2(node_, node_output_index_);
|
||||
return get_default_hash_2(*node_, node_output_index_);
|
||||
}
|
||||
|
||||
const fn::CPPType &cpp_type() const
|
||||
|
||||
Reference in New Issue
Block a user