Can pointers be safely and portably used as object IDs?

Viewed 3244

Suppose I have a bunch of valid pointers to instances of a class A. Can I safely and portably assume that the pointers will stay the same during the whole object lifetime? In other words, can I use a pointer to an object as a unique object ID?

9 Answers
Related