Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-06-08 05:46:36


Gottlob Frege wrote:
> IIRC, one of boost's smart ptrs can be used with an incomplete type.
> How is the compile of the destructor delayed?
>
> ie
>
> ~my_smart_ptr()
> {
> get()->~T(); // error: T is an incomplete type
> }

In pseudocode, something along the lines of:

class my_smart_ptr
{
    T * p;
    void (*f)( T* );

    my_smart_ptr( T* p ): p( p ), f( &delete ) {}
    ~my_smart_ptr() { f(p); }
};

> I wondered through lots of the shared_ptr code, but I got a bit
> bleary-eyed. On that note, does anyone have a script or
> preprocessor call or something that converts all the boost code into
> the 'clean and ideal boost'? ie the one without the layers and
> layers of compiler workarounds, etc?

shared_ptr doesn't have _that_ many compiler workarounds. :-)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net