On 05/04/2018 06:33 PM, Neia Neutuladh wrote:
auto asDelegate(TFunc)(TFunc func) @trusted
     import std.functional : toDelegate;
     return toDelegate(func);

The "@trusted" means that you promise this thing is safe, even if the compiler can't be certain.

If toDelegate isn't (always) @safe, how can you be sure that your wrapper is? Also, TFunc may have an unsafe destructor.

That's not good use of `@trusted`.

Reply via email to