What legitimate reasons exist to overload the unary operator&?

前端 未结 7 1848
悲哀的现实
悲哀的现实 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条回答
  •  广开言路
    2020-11-28 07:45

    You can overload the address operator to make it private. This could be useful for implementing some sort of baton passing scheme, where the address of the baton cannot be taken. If the baton's constructors are hidden, this can keep the baton's scope airtight.

提交回复
热议问题