On Monday, November 18, 2013 09:59:44 Jacob Carlborg wrote:
> Just do something like this:
>
> void trusted_nothrow (alias block) ()
> {
> scope(failure) assert(0);
> block();
> }
>
> trusted_nothrow!({
> // code
> });
>
> Not as pretty. Yet another prefect example for AST macros :)I don't see much gain over simply putting scope(failure) at the top. You just avoid having to write the assertion yourself. I also expect that it wouldn't work with return statements. - Jonathan M Davis
