std.traits: ParameterIdentifierTuple on 'interface' not working ?
ted via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 20 16:51:08 PDT 2015
Is this behaviour expected ?
(dmd2.068, linux 64bit)
dmd -oftest test.d
(string, uint, bool)
tuple("a", "b", "c")
(string, uint, bool)
tuple("", "", "")
(i.e. ParameterIdentifierTuple does not appear to work for interfaces? -
what am I doing incorrectly?)
test.d:
import std.traits;
interface IFoo { ulong foo_me(string a, uint b, bool c); }
class myFoo:IFoo{ ulong foo_me(string a, uint b, bool c){ return 42; } }
void main()
{
auto tmp_foo = new myFoo;
alias ParameterTypeTuple!(tmp_foo.foo_me) tmpfooTypes;
pragma(msg,tmpfooTypes);
alias ParameterIdentifierTuple!(tmp_foo.foo_me) tmpfooNames;
pragma(msg,tmpfooNames);
foreach ( method; __traits(allMembers, IFoo))
{
alias MemberFunctionsTuple!(IFoo, method) funcs;
alias typeof(funcs[0]) func;
alias ReturnType!func return_type;
alias ParameterTypeTuple!func ParameterTypes;
alias ParameterIdentifierTuple!func ParameterNames;
pragma(msg,ParameterTypes);
pragma(msg,ParameterNames);
}
}
More information about the Digitalmars-d
mailing list