Boost logo

Boost Users :

From: Bernard Chen (bchen_at_[hidden])
Date: 2005-03-16 12:56:51


Hello,

 

I was looking at the casting functions and the one that had the behavior
I wanted most was the shared_polymorphic_cast. I do not want an empty
shared_ptr<T> to be created if the cast cannot be performed. I would
prefer to have an exception thrown in debug mode and release mode. The
problem is that while going through the shared_ptr.hpp, I found a
comment on line number 388 just above all the cast conversion functions
"// shared_*_cast names are deprecated. Use *_pointer_cast instead." I
have not found a *_pointer_cast function that does what I want. The
dynamic_pointer_cast does not throw an exception. Is there a good
alternative? Should I enforce a standard on my team of using
dynamic_pointer_cast along with a run-time check of seeing if an empty
shared_ptr<T> was created?

 

Thanks,

 

Bernard

 



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