|
Boost : |
From: Bronek Kozicki (brok_at_[hidden])
Date: 2005-10-11 11:49:23
As I understand, checked_delete is being used by scoped_ptr to prevent
deletion of incomplete type. However, this very simple program is
accepted by MSVC6, MSVC71 and MinGW (GCC) 3.4.4, even though implicit
destructor of A is deleting incomplete class A::impl . Only one compiler
of these that I could test (Comeau 4.3.3) throws compilation error.
Could we do better?
I know, there are simple workaround - declare destructor in class A or
use shared_ptr . But as we know, workarounds in user code to generate
compilation error (not suppress them) are rare thing.
B.
#include <boost/scoped_ptr.hpp>
struct A
{
struct impl;
boost::scoped_ptr<impl> impl_;
A();
};
int main()
{
A a;
}
struct A::impl
{};
A::A() : impl_(new impl()) {}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk