From ce6a647dd051ecb4083fe1174da765275b747354 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 30 Jul 2004 04:32:43 +0000 Subject: [PATCH] Work-around for CW8 problems with static_cast of references to templates. [SVN r24178] --- .../boost/algorithm/string/classification.hpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/include/boost/algorithm/string/classification.hpp b/include/boost/algorithm/string/classification.hpp index 9811fb0..e2d7c39 100644 --- a/include/boost/algorithm/string/classification.hpp +++ b/include/boost/algorithm/string/classification.hpp @@ -235,9 +235,12 @@ namespace boost { const predicate_facade& Pred1, const predicate_facade& Pred2 ) { + // Doing the static_cast with the pointer instead of the reference + // is a workaround for some compilers which have problems with + // static_cast's of template references, i.e. CW8. /grafik/ return detail::pred_andF( - static_cast(Pred1), - static_cast(Pred2) ); + *static_cast(&Pred1), + *static_cast(&Pred2) ); } //! predicate 'or' composition predicate @@ -256,9 +259,12 @@ namespace boost { const predicate_facade& Pred1, const predicate_facade& Pred2 ) { + // Doing the static_cast with the pointer instead of the reference + // is a workaround for some compilers which have problems with + // static_cast's of template references, i.e. CW8. /grafik/ return detail::pred_orF( - static_cast(Pred1), - static_cast(Pred2)); + *static_cast(&Pred1), + *static_cast(&Pred2)); } //! predicate negation operator @@ -273,7 +279,10 @@ namespace boost { inline detail::pred_notF operator!( const predicate_facade& Pred ) { - return detail::pred_notF(static_cast(Pred)); + // Doing the static_cast with the pointer instead of the reference + // is a workaround for some compilers which have problems with + // static_cast's of template references, i.e. CW8. /grafik/ + return detail::pred_notF(*static_cast(&Pred)); } } // namespace algorithm