Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- import std.traits;
- alias FooFn = void function(int) nothrow;
- void callFoo(FooFn fooFn)
- {
- fooFn(42);
- }
- void foo(int x)
- {
- writeln(x);
- }
- void bar(string s)
- {
- writeln(s);
- }
- void main(string [] args) {
- FooFn fooFn = cast(SetFunctionAttributes!(FooFn, functionLinkage!FooFn, FunctionAttribute.nothrow_))&bar;
- callFoo(fooFn);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement