On 23/07/2020 18:24, Adrian Prantl wrote: > Is there some clever C++ way to prohibit taking an object's address (similar > to how you can delete a copy constructor)? > > -- adrian
You could =delete the address-of operator, but redefining unary & is generally frowned upon and I am not sure it will achieve what you want -- it would not prevent anyone from binding a reference to an existing object. I don't think there's any way to prevent that, and even if it were, it would likely break too much generic code which expects to accept objects by const&. pl _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits