Boost logo

Boost Users :

From: Pavel Syomin (syomin_at_[hidden])
Date: 2007-07-10 07:36:52


Hi, guys!

I found embarrassing difference between shared_ptr::operator*() and
intrusive_ptr::operator*() behavior (even the same I can say about
operator ->).

At first, look on shared_ptr:
reference operator* () const // never throws
{
    BOOST_ASSERT(px != 0);
    return *px;
}

If shared_ptr object has NULL value and someone call operator*(), it
will throws exception. But if we look on intrusive_ptr():
T & operator*() const
{
    return *p_;
}
we can see, that pointer don't checks.... Is it an imperfection or a
feature?


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