boost::checked_detele(r) に関して、質問をいただいたので、Pimpl イディオムを絡めた解説を行おうと思う。ただし、長くなるので、日を分けてお送りしたい。

boost のドキュメントに曰く、

The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be deleted with a delete-expression. When the class has a non-trivial destructor, or a class-specific operator delete, the behavior is undefined. Some compilers issue a warning when an incomplete type is deleted, but unfortunately, not all do, and programmers sometimes ignore or disable warnings.

定義が不完全なクラスへのポインタを delete しようとすると、なんかちょっとやばいことが起こるかもしんないよ、って書いてある。いったい何が起こるんだろう?