Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-10-03 15:45:56


"Eric Woodruff" <Eric.Woodruff_at_[hidden]> wrote in message
news:ani8r4$6h1$1_at_main.gmane.org...
> No, that wont work. That would still require it's base to be copied--the
> same copy that occurs already.
> [...]

Hmm...I just tried this code, and Comeau warns that the conversion operator
will not be called for implicit or explicit conversions. Any idea why?

template <typename T>
class const_shared_ptr
{
public:
    typedef T const element_type;
};

template <typename T>
class shared_ptr : const_shared_ptr<T>
{
public:
  operator const_shared_ptr<T> const&() const
  {
    return static_cast<const_shared_ptr<T> const&>(*this);
  }
};

Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk