digitalmars.D.learn - Marking a delegate as pure, nothrow, etc.
- Joseph Rushton Wakeling (1/1) Apr 13 2014 Is it possible to mark a delegate as pure, @safe, nothrow, etc.? And if...
- Meta (11/13) Apr 13 2014 If it's while creating a delegate literal, it's valid to mark it
Is it possible to mark a delegate as pure, safe, nothrow, etc.? And if so, how?
Apr 13 2014
On Sunday, 13 April 2014 at 17:58:27 UTC, Joseph Rushton Wakeling wrote:Is it possible to mark a delegate as pure, safe, nothrow, etc.? And if so, how?If it's while creating a delegate literal, it's valid to mark it with safe pure nothrow: auto n = delegate int() safe pure nothrow { return 1; }; If it's an already-existing delegate, you can use a cast: auto m = 0; auto del = delegate int() system { throw new Exception("test"); return m; } cast(int delegate() safe pure nothrow)del //del is now safe pure nothrow
Apr 13 2014