On 05/01/2012 05:26, Andrej Mitrovic wrote:
<snip>
The first call doesn't do anything because the delegate is wrapped
inside of another delegate. I want this template to be versatile
enough to be used by both lazy expressions and delegate literals, but
I don't know how.
<snip>
If you have a delegate you want to use as a lazy expression, you can make the lazy
argument a call to it
onFailThrow!Exception({ to!int(x); }());
Of course, Peter's solution enables you to omit the () and just pass the delegate in, but
it does mean that you can't lazily evaluate an expression to a delegate, unless you wrap
it in a delegate literal.
Stewart.