Copying parameter lists verbatim

Manu via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 18 23:06:28 PDT 2014


So, about 2 years back I motivated a bunch of work on traits relating to
parameter lists.
I'm looking at std.traits now, but I can't see one of the things that I
could have sworn was added at the time.

I need to clone a functions parameter list, including the names and default
args. Ie.

  void f(int x, float y = 10);
  void myFunc(CloneParameterList!f)
  assert(myFunc.stringof == "void myFunc(int x, float y = 10)");

It wasn't that, but I recall agreeing that it was possible now... but I
can't see how to do it.
I thought it was implemented using a __traits, but nothing stands out to me.

Looking at the source in std.traits, it refers to FunctionTypeOf, which I
don't recall anything about when we were implementing this stuff initially.
Perhaps there's been further development and changes since I last looked at
it...?

Anyway, does anybody know a nice tidy way to do it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140719/719b4bf8/attachment.html>


More information about the Digitalmars-d mailing list