What’s the most reliable way to prohibit a copy constructor in C++?

The first one is better

Even better is C++0x ‘delete’ keyword:

class Class {
// useful stuff, then
public:
    Class(const Class&) = delete;
    void operator=(const Class&) = delete;
};

Leave a Comment