From aac8fcb4b666c0357227725de28c1759841751f8 Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Thu, 27 Jul 2006 10:27:37 +0000 Subject: [PATCH] boost guidelines (mainly from inspect tool: tabs, license reference text, etc.) [SVN r34752] --- include/boost/implicit_cast.hpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/include/boost/implicit_cast.hpp b/include/boost/implicit_cast.hpp index 2593cb4..27e1639 100755 --- a/include/boost/implicit_cast.hpp +++ b/include/boost/implicit_cast.hpp @@ -23,13 +23,22 @@ inline T implicit_cast (typename mpl::identity::type x) { //template //void implicit_cast (...); -// Macro for when you need a constant expression (Gennaro Prota) -#define BOOST_IMPLICIT_CAST(dst_type, expr) \ - ( sizeof( implicit_cast(expr) ) \ - , \ - static_cast(expr) \ - ) - } // namespace boost + + +// Macro for when you need a constant expression. +// Note that 'expr' is evaluated at most once, though +// it appears three times (provided by Gennaro Prota; see +// http://lists.boost.org/Archives/boost/2004/05/65687.php) +// +#define BOOST_IMPLICIT_CAST(dest_type, expr) \ + ( static_cast( \ + sizeof(boost::implicit_cast(expr)) ? \ + (expr) : (expr) \ + ) \ + ) /**/ + + + #endif // IMPLICIT_CAST_DWA200356_HPP