Meaning of = delete after function declaration
Deleting a function is a C++11 feature:
The common idiom of "prohibiting copying" can now be expressed directly:
class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; };
[...]
The "delete" mechanism can be used for any function. For example, we can eliminate an undesired conversion like this:
struct Z { // ... Z(long long); // can initialize with a long long Z(long) = delete; // but not anything less };
= 0
means that a function is pure virtual and you cannot instantiate an object from this class. You need to derive from it and implement this method= delete
means that the compiler will not generate those constructors for you. AFAIK this is only allowed on copy constructor and assignment operator. But I am not too good at the upcoming standard.