Last active
August 29, 2015 14:05
-
-
Save DmitryOlshansky/bc02f369c8a63818bd07 to your computer and use it in GitHub Desktop.
Encapsulating trust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module trusted; | |
/// Forward arguments to some @system callable $(D fun) | |
auto ref call(alias fun, Args...)(auto ref Args args) @trusted | |
{ | |
return fun(args); | |
} | |
/// @trusted function to clearly isolate taking address of a local | |
auto addrOf(T)(ref T value) @trusted | |
{ | |
return &value; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment