What's the most reliable way to prohibit a copy constructor in C++?
Sometimes it's necessary to prohibit a copy constructor in a C++ class so that class becomes "non-copyable". Of course, operator= should be prohibited at the same time. So far I've seen two ways to do that. Way 1 is to declare the method private and give it no implementation: class Class { //useful stuff, then private: Class( const Class& ); //not implemented anywhere void operator=( const Class& ); //not implemented anywhere }; Way 2 is to declare the method private and give it "empty" implementation: class Class { //useful stuff, then private: Class( const Class& ) {} void operator=( const