I want to do the opposite of making instances of a class noncopyable
, that is, make sure that instances of a particular class can be passed only as a copy and not as a reference. If any function tries to receive it by reference, I would like it to give a compilation error (ideally) or a run time error.
I dont think making operator &
private is going to do it, is there a legitimate way of doing this.