"Mirek Fidler" <> wrote in message
news: oups.com...
>
> Sylvester Hesp wrote:
>> Foo & operator , (const Foo & foo, bool b)
>> {
>> return foo;
>> }
>>
>> now what? 
>
> OK, you want to play it hard, let us play hard 
>
> template <class T>
> void Q(const T&) {}
>
> b && (Q(foo = foo), true)
>
You can hardly call that usable
>> Bottom-line: use ifs for these kinds of constructs.
>
> Of course. But as I said, it can be seldom useful for macro hackery -
> the whole thing is still an expression, not statement. Think about
> things like boost's FOREACH macro....
My remark was more aimed at the OP, but fair enough, for a macro it would be
useful. You don't need the Q function btw, you could also cast to void:
b && ((void)(foo = foo), true)
I think now it's as good as unbreakable
- Sylvester