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
The first method is how Boost solves it (source code), as far as I know, there's no drawbacks. In fact, the linker errors are the big advantage of that method. You want the errors to be at link time, not when your client is executing your code and it suddenly crashes.
In case you are using Boost, you can save yourself some typing. This does the same as your first example:
#include
class Class : boost::noncopyable {
// Stuff here
}