A deleted definition of a function is
a function definition whose
function-body
is of the form
=delete ;
or an explicitly-defaulted definition of the function where the function is
defined as deleted.
A deleted function is
a function with a
deleted definition or a function that is implicitly defined as deleted.
One can prevent default initialization and
initialization by non-doubles with
struct onlydouble {
onlydouble()=delete; // OK, but redundanttemplate<class T>
onlydouble(T)=delete;
onlydouble(double);
};
One can make a class uncopyable, i.e., move-only, by using deleted
definitions of the copy constructor and copy assignment operator, and then
providing defaulted definitions of the move constructor and move assignment operator.
The
one-definition rule ([basic.def.odr]) applies to deleted definitions.
— end note]
A deleted definition of a function shall be the first declaration of the function or,
for an explicit specialization of a function template, the first declaration of that
specialization.
An implicitly declared allocation or deallocation function ([basic.stc.dynamic])
shall not be defined as deleted.
[Example 4: struct sometype {
sometype();
};
sometype::sometype()=delete; // error: not first declaration — end example]