Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-26 09:30:07


From: "Olaf Petzold" <yg-boost-users_at_[hidden]>
>
> struct C : public BaseC {
> C() : b( new B("C::b") ) { }
> void set(const boost::shared_ptr<A>& ptr) {
> b.swap( boost::shared_static_cast<B>( ptr ) ); // L21
> }
> void print() { std::cout << b->name << std::endl; }
> boost::shared_ptr<B> b;
> };

Why not simply

b = boost::shared_static_cast<B>( ptr );

or

b = boost::shared_polymorphic_cast<B>( ptr );

?


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