What legitimate reasons exist to overload the unary operator&?

前端 未结 7 1824
悲哀的现实
悲哀的现实 2020-11-28 07:39

Okay, I\'ve been inspired to do some head punching. Seems like overloading operator& leads to not a small amount of pain.

What legitimate cases exis

7条回答
  •  萌比男神i
    2020-11-28 07:51

    Once I used to override operator & (without altering its behavior) as private to the class, in order to protect against occasional creation of smart pointer to the object created in the stack. Still not sure if it was really good idea...

提交回复
热议问题