
Hello Watanabe, It seems to be a problem of my mail editor. I have used the correct static_cast grammar but some characters were silently eaten. :-( Sorry for misleading. At last, I've found the problem and the working code is as follows: #define DECLARE_PTR_AUTO_DELETOR_CONDITIONAL(CLASS, VAR_PTR, CONDITION)\ boost::scoped_ptr<CLASS> auto__deletor__for__ ## VAR_PTR (\ (boost::lambda::if_then_else_return(boost::lambda::_1, VAR_PTR,\ static_cast<CLASS*>(0))) (CONDITION)) I should use if_then_else_return instead of if_then_else. Thanks for help. B/Rgds Max ----- Original Message ----- From: Steven Watanabe <watanabesj@gmail.com> To: boost-users@lists.boost.org Subject: Re: [Boost-users] [lambda] Should the code compile? Date: 2008-12-31 00:51:01 AMDG Max wrote:
I have the following simple code, but doesn't get compiled:
#define DECLARE_PTR_AUTO_DELETOR_CONDITIONAL(CLASS, VAR_PTR, CONDITION)\ boost::scoped_ptr auto__deletor__for__ ## VAR_PTR (\ boost::lambda::ret(boost::lambda::if_then_else(_1,\ VAR_PTR, static_cast(0)))(static_cast(CONDITION)))
That's not the correct syntax for static_cast In Christ, Steven Watanabe ------------------------------------------------------------------- 新浪空间——与朋友开心分享网络新生活!(http://space.sina.com.cn/ )