Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void foo(A, B, C)(A a, B b, C c) { writeln(a, b, c) }
- // is logically equivalent to:
- auto foo(A, B, C)
- {
- // # means "expression that follows should be evaluated at compile-time".
- // In this case, # forces the return value to be a compile-time function object
- // (not run-time pointer)
- return #(A a, B b, C c)-> { writeln(a, b, c) }
- }
- void main()
- {
- auto args = {1, "two", 3.0}
- foo(args.typeof)(args.flat)
- alias bar = foo(bool, string)
- bar(true, "blah")
- }
Add Comment
Please, Sign In to add comment