Boost logo

Boost Users :

From: Jean-Pierre Bergamin (james_at_[hidden])
Date: 2008-02-18 14:49:03


Peter Dimov schrieb:
> Richard:
>
>> [Please do not mail me a copy of your followup]
>>
>> boost-users_at_[hidden] spake the secret code
>> <011a01c87003$0ff77eb0$6407a80a_at_pdimov2> thusly:
>>
>>
>>> [...] This thread did spark my interest though and I was able to add
>>> && and || to the trunk, complete with the proper short-circuit semantics.
>>>
>> Can you elaborate on the approach you took? I thought it was
>> essentially impossible to replicate the short-circuit semantics with
>> your own user-defined operator|| and operator&&.
>>
>
> It is impossible to overload && in such a way so that in e1 && e2, e2 is not
> evaluated when e1 is false. But it's possible to overload f && g so that in
> (f && g)(x) :- f(x) && g(x), g(x) is not evaluated when f(x) is false.
>
Very nice. Your changes do the trick and we hopefully see the changes
soon in an official release.

Thanks

Jean-Pierre Bergamin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net