|
Boost Users : |
From: Tommy Hinks (tommy.hinks_at_[hidden])
Date: 2006-07-14 12:21:33
You can't pass 0 because the Type passed must be an Investment*, not
just a type that could be cast to one. This is why you have to
explicitly cast it yourself.
Tommy
On 14/07/06, Zhuo Hao <hzhuo1_at_[hidden]> wrote:
> In file <boost/shared_ptr.hpp>, I find the following function:
> /begin quote
> template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
> {
> detail::sp_enable_shared_from_this( pn, p, p );
> }
> /end quote
> If I use it as follows:"boost::shared_ptr<Investment>
> pInv(0,getRidOfInvestment)",it will not compile.But when I
> use:"boost::shared_ptr<Investment>
> pInv(static_cast<Investment*>(0),getRidOfInvestment)",it
> can be compiled.
> The constructor's first parameter is Y*,i.e.,a pointer to Y.And 0 can be
> interpreted as a pointer to Y,too. Why can't zero be treated as a pointer
> to Y here?
>
> I will be appreciative if anyone can give me some suggestions.Thank you!
>
> hzhuo
> July,14th
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
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