What does this *delete
mean in front of the constructor?
Grap& operator=(const Grab &g) = delete;
What does this *delete
mean in front of the constructor?
Grap& operator=(const Grab &g) = delete;
Note that this is an assignment operator and not a constructor. And it's a matter of point of view, but for me the keyword delete
behind the operator statement.
It is invalidating this operation. Every type in C ++ has the assignment operator created automatically by the compiler if none is provided. When your type can not allow assignments to be made with it, this is the way to prevent the compiler from creating the operator for you.
You can do the same with the copy operator.
Only available from C ++ 11.