On Wed, May 16, 2012 at 10:41:06PM +0200, Mehrdad wrote:
> Oh, and I just invented a most *lovely* cast:  :P
> 
> auto noThrow(T)(scope T function() t) nothrow
> { return (cast(T function() nothrow)t)(); }
> 
> auto noThrow(T)(scope T delegate() t) nothrow
> { return (cast(T delegate() nothrow)t)(); }

What about:

        auto noThrow(T,U...)(scope T function(U) t) nothrow {
                return (cast(T function(U) nothrow)t)();
        }

        auto noThrow(T,U...)(scope T delegate(U) t) nothrow {
                return (cast(T delegate(U) nothrow)t)();
        }

?

(I've no idea if this actually works, but it does allow you to wrap
almost _any_ function.)


T

-- 
Lawyer: (n.) An innocence-vending machine, the effectiveness of which
depends on how much money is inserted.

Reply via email to