Boost logo

Boost :

From: Csaba Szepesvari (szepes_at_[hidden])
Date: 2000-10-31 03:51:07


> The following ugly patch seems to fix the problem:
>
> template<class T,class U> T do_dynamic_cast(U& r) {
> return dynamic_cast<T>(r);
> }
> template<class T,class U> T do_dynamic_cast(U* p) {
> return dynamic_cast<T>(p);
> }
> #define dynamic_cast do_dynamic_cast
>

Note: Strictly speaking, you do not need to use the macro in the second
case (bad pointer-casts do not throw but return 0).
In other words, if you used dynamic_cast only with pointers with MSVC -
you're safe.
(But of course if you want a uniform substitute then you need both
macros)

- Csaba


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