Skip to content

Instantly share code, notes, and snippets.

@DmitryOlshansky
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DmitryOlshansky/bc02f369c8a63818bd07 to your computer and use it in GitHub Desktop.
Save DmitryOlshansky/bc02f369c8a63818bd07 to your computer and use it in GitHub Desktop.
Encapsulating trust
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