[Issue 1839] Give D a modern varargs system that allows forwarding
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 15 00:47:07 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1839
------- Comment #6 from andrei at metalanguage.com 2008-02-15 02:47 -------
(In reply to comment #5)
> If (...) functions go away, then yes, this bug report becomes pointless. The
> template versions of forwarding will do the trick.
>
> But how do I create a delegate that takes an arbitrary list of arbitrary
> arguments using templates?
>
import std.stdio;
void before() {}
void after() {}
void forward(F, T...)(F fun, T args)
{
before();
scope(exit) after();
fun(args);
}
void main()
{
forward((int a) { writeln(a + 40); }, 2);
}
--
More information about the Digitalmars-d-bugs
mailing list