Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-10 12:05:36


From: "jacob_bondski" <bondski_at_[hidden]>
>
> The VC++ compiler (6.0 with SP 5) has problems with member function
> templates. We have encountered a couple of situations where a
> shared_ptr was created and an attempt was later made to assign a raw
> pointer to it. However,
>
> 1) The compiler fails to recognise that you can't assign
> a raw pointer to an existing shared pointer object
> 2) The compiler fails to generate any code whatsoever for
> the assignment
> 3) The compiler remains silent about its problems

The current code base contains a workaround for this problem:

#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200)

    template<typename Y>
    shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
    {
        px = r.px;
        pn = r.pn; // shared_count::op= doesn't throw
        return *this;
    }

#endif

You can apply it to your version of shared_ptr.hpp, or you can use the CVS
version of Boost. The 1.29.0 release is close, so the CVS is (hopefully)
pretty stable.


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