vendredi 27 février 2015

Macro to make class noncopyable

Is their any problem with following macro that makes class noncopyable?



#define PREVENT_COPY(class_name)
class_name(const class_name&) = delete;\
class_name& operator=(const class_name&) = delete;

class Foo
{
public:
PREVENT_COPY(Foo)

// .......
};

Aucun commentaire:

Enregistrer un commentaire