Can you compare objects by address for equality?

前端 未结 4 2035
旧时难觅i
旧时难觅i 2021-02-13 13:58

I have a function that compares objects by each attribute to see if they are identical. But I was just wondering, would it be better to compare the object by their address inste

4条回答
  •  抹茶落季
    2021-02-13 14:39

    If you have objects for which comparison is time consuming, comparing the pointers could be used as a fast way to determine object equivalence (i.e., if the pointers are equal, objects are equivalent, otherwise they may still be equivalent)

提交回复
热议问题