In this SO question is stated that this construct prevents stack allocation of instance.
class FS_Only {
~FS_Only() = delete; // disallow stack allocation
};
My question is, how does it prevents allocation? I understand, that is not possible to delete this instance, either explicitly or implicitly. But I think, that would lead to memory leak or run time error, respectively.
Are compilers smart enough to sort this out and raise compiler error? Also why would one need this?
See Question&Answers more detail:os