Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-09-14 02:08:22


The following paragraph

-----------
The C++ built-in dynamic_cast can be used for downcasts and crosscasts of
pointers to polymorphic objects, but error notification in the form of a
returned value of 0 is inconvenient to test, or worse yet, easy to forget to
test. The polymorphic_cast template performs a dynamic_cast, and throws an
exception if the dynamic_cast returns 0.

-----------

should be extended with:

-------------

Moreover, polymorphic_cast is safer than a dynamic_cast using references
since it does not need to dereference the pointer. This means that the
casted pointer can be 0; in this case a dynamic_cast with references will
result in undefined behavior.

-------------

I've attached the new paragraph in html.

Thorsten Ottosen
----------------------------
Dezide Aps
www.dezide.com

begin 666 cast.html_patch.txt
M/' ^5&AE($,K*R!B=6EL="UI;B \8CYD>6YA;6EC7V-A<W0\+V(^(&-A;B!B
M92!U<V5D(&9O<B!D;W=N8V%S=',@86YD(&-R;W-S8V%S=',-"F]F('!O:6YT
M97)S('1O('!O;'EM;W)P:&EC(&]B:F5C=',L(&)U="!E<G)O<B!N;W1I9FEC
M871I;VX@:6X@=&AE(&9O<FT@;V8_at_80T*<F5T=7)N960@=F%L=64@;V8@,"!I
M<R!I;F-O;G9E;FEE;G0@=&\@=&5S="P@;W(@=V]R<V4@>65T+"!E87-Y('1O
M(&9O<F=E="!T;PT*=&5S="X_at_5&AE(#QB/G!O;'EM;W)P:&EC7V-A<W0\+V(^
M('1E;7!L871E('!E<F9O<FUS(&$@/&(^9'EN86UI8U]C87-T/"]B/BP-"F%N
M9"!T:')O=W,@86X_at_97AC97!T:6]N(&EF('1H92 \8CYD>6YA;6EC7V-A<W0\
M+V(^(')E='5R;G,@,"X_at_36]R96]V97(L(#QB/G!O;'EM;W)P:&EC7V-A<W0\
M+V(^(&ES('-A9F5R('1H86X_at_82 \8CYD>6YA;6EC7V-A<W0\+V(^('5S:6YG
M(')E9F5R96YC97,@<VEN8V4@:70_at_9&]E<R!N;W0@;F5E9"!T;R!D97)E9F5R
M96YC92!T:&4@<&]I;G1E<BX_at_5&AI<R!M96%N<R!T:&%T('1H92!C87-T960@
M<&]I;G1E<B!C86X_at_8F4@,#L@:6X@=&AI<R!C87-E(&$@/&(^9'EN86UI8U]C
M87-T/"]B/B!W:71H(')E9F5R96YC97,@=VEL;"!R97-U;'0@:6X@=6YD969I
1;F5D(&)E:&%V:6]R+CPO<#X`
`
end


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