Boost logo

Boost Users :

From: Gennadiy E. Rozental (rogeeff_at_[hidden])
Date: 2002-09-19 10:07:01


--- In Boost-Users_at_y..., "Brian" <bneal_at_z...> wrote:
> --- In Boost-Users_at_y..., "Gennadiy E. Rozental" <rogeeff_at_m...>
wrote:
> > This was discussed during Boost.Test review.
> > Peter some time ago made a changes in boost::shared_ptr that
allows
> > it to be used with Borland 5.5 namely in the situation you
> described.
> >
> > Gennadiy.
>
> Hi...could you clarify this? All I noticed was that shared_ptr had
> that compile time check for an incomplete type removed, whereas
> scoped_ptr still has it. Are you saying that if I switch from
> scoped_ptr to shared_ptr the destructor will get called?
>
> Regards,
>
> Brian Neal

The general idea:

class A {
...
    A() : m_deleter( checked_deleter() )
    ~A() { m_deleter( m_ptr ); }

    deleter_function m_deleter;
    T* m_ptr;
};

AFAIK this way compiler does not know in a destructor what will
happend with the m_ptr and does not try to istantiate ~T().

Gennadiiy.


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