Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2004-07-30 01:37:42


On Thu, Jul 29, 2004 at 04:39:46PM -0500, Rene Rivera wrote:
> It took some digging but I figured out what the problem with the failure
> on this test is for CW8. Basically CW8 is doing a copy construction on
> the use of static_cast for a reference when the type of the reference is
> itself a template typename. In all other cases it does the cast
> correctly. The work-around is to do the cast on the pointer type and
> dereference instead of the cast on the reference directly:
>
> ===================================================================
> RCS file: /cvsroot/boost/boost/boost/algorithm/string/classification.hpp,v
> retrieving revision 1.4
> diff -u -r1.4 classification.hpp
> --- classification.hpp 15 Jul 2004 21:48:25 -0000 1.4
> +++ classification.hpp 29 Jul 2004 21:32:49 -0000
> @@ -236,8 +236,8 @@
> const predicate_facade<Pred2T>& Pred2 )
> {
> return detail::pred_andF<Pred1T,Pred2T>(
> - static_cast<const Pred1T&>(Pred1),
> - static_cast<const Pred2T&>(Pred2) );
> + *static_cast<const Pred1T*>(&Pred1),
> + *static_cast<const Pred2T*>(&Pred2) );
> }
>
> //! predicate 'or' composition predicate
> @@ -257,8 +257,8 @@
> const predicate_facade<Pred2T>& Pred2 )
> {
> return detail::pred_orF<Pred1T,Pred2T>(
> - static_cast<const Pred1T&>(Pred1),
> - static_cast<const Pred2T&>(Pred2));
> + *static_cast<const Pred1T*>(&Pred1),
> + *static_cast<const Pred2T*>(&Pred2));
> }
>
> //! predicate negation operator
> @@ -273,7 +273,7 @@
> inline detail::pred_notF<PredT>
> operator!( const predicate_facade<PredT>& Pred )
> {
> - return detail::pred_notF<PredT>(static_cast<const
> PredT&>(Pred));
> + return detail::pred_notF<PredT>(*static_cast<const
> PredT*>(&Pred));
> }
>
> } // namespace algorithm
> ===================================================================
>
> Those changes make it work on CW8, and it still works on VC7.1 and MinGW.
>
> OK to commit?? -- I'll assume the answer is *yes* after a few hours ;-)
>

Seems ok to me. This change should not break any other compilere since it is
correct. Thanks for help.

Regards,

Pavol


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