I have a Visual Studio 2008 C++03 application where I would like to use boost::lambda to perform this action:
enum { fooflag = 0x00000001; }
bool IsFooFlagActive( DWORD flags )
{
return ( flags & fooflag ) != 0;
}
Unfortunately, this doesn't work:
namespace bl = boost::lambda;
bool is_foo_flag_active = ( ( bl::_1 & fooflag ) != 0 )( 0x00000001 );
What's the correct way to get boost::lambda to perform compound expressions? Do I need to bind the != operator?
Thanks
I don't know what the underlying issue is, but adding a cast makes it work:
That being said, stop using Boost.Lambda in new code – it's been officially deprecated (in all but documentation) in favor of Boost.Phoenix for nearly a year now, and with good reason. (And your code compiles cleanly as-is when using Phoenix rather than Lambda.)