[Issue 5175] Add a way to get parameter names to std.traits
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 22 19:37:14 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5175
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-01-22 19:37:08 PST ---
Well there is now __parameters, but this gives out both the types, param names,
and default values:
void test(int x, int y = 1) { }
template ParameterTuple(alias func)
{
static if(is(typeof(func) P == __parameters))
alias P ParameterTuple;
else
static assert(0);
}
void main()
{
pragma(msg, ParameterTuple!test);
}
> (int x, int y = 1)
I would personally like to wrap ParameterTypeTuple, ParameterStorageClassTuple,
and provide a single GetParameters template which would return a tuple of these
struct objects:
struct Parameter(Type, alias DefVal)
{
ParameterStorageClass stc;
Type type;
string name;
alias DefVal defaultValue;
}
It's questionable how doable this is but it would make the API easier to use.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list