Silencing GCC warnings when using an "Uncopyable" class
- by Kazade
I have several classes that I don't want to be copyable, some of these classes have pointer data members. To make these classes uncopyable I privately inherit the following class template:
template <class T>
class Uncopyable
{
protected:
Uncopyable() {}
virtual ~Uncopyable() {}
private:
Uncopyable(const Uncopyable &);
T & operator=(const T&);
};
Which I used like so:
class Entity : private Uncopyable<Entity> { }
This works fine, however when I compile with -Weffc++ I still get the following warning:
class Entity has pointer data members
but does not override Entity(const Entity&)
or operator=(const Entity&)
Why is it still giving me this warning?