Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 26, 2016 all functions that have a first arg of type T | ||||
---|---|---|---|---|
| ||||
foreach(m; __traits(allMembers, vulkan_input)) { static if (m.endsWith("_T")) { foreach(m2; __traits(allMembers, vulkan_input)) { static if (__traits(isStaticFunction,typeof(m2)))// <- what here? { enum fn = __traits(getMember,vulkan_input, m2); enum parameters = Parameters!(fn); static if (parameters[0] == m) writeln( m, ":",m2); } } } } m2 is a string I've tried mixin: gives me Error: function vulkan_input.VK_MAKE_VERSION (int major, int minor, int patch) is not callable using argument types () and various combos of typeof and mixin typeof(m2) is an __error typeof(mixin(m2)) " T is not an expression". fails for m2 == uint etc and m2 == module gives module had no type Nic |
February 26, 2016 Re: all functions that have a first arg of type T | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | On Friday, 26 February 2016 at 03:57:25 UTC, Nicholas Wilson wrote: > foreach(m; __traits(allMembers, vulkan_input)) > { > static if (m.endsWith("_T")) > { > foreach(m2; __traits(allMembers, vulkan_input)) > { > static if (__traits(isStaticFunction,typeof(m2)))// <- what here? > { > enum fn = __traits(getMember,vulkan_input, m2); > enum parameters = Parameters!(fn); > static if (parameters[0] == m) > writeln( m, ":",m2); > } > } > } > } static if (__traits(isStaticFunction,typeof(m2))) static if (__traits(isStaticFunction, __traits(getMember, vulkan_input, m2)))) |
February 26, 2016 Re: all functions that have a first arg of type T | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 26 February 2016 at 04:19:29 UTC, BBasile wrote:
> static if (__traits(isStaticFunction,typeof(m2)))
>
> static if (__traits(isStaticFunction, __traits(getMember, vulkan_input, m2))))
Sorry don't copy paste like this there's a superfluous right paren.
static if (__traits(isStaticFunction, __traits(getMember, vulkan_input, m2)))
|
February 26, 2016 Re: all functions that have a first arg of type T | ||||
---|---|---|---|---|
| ||||
Posted in reply to BBasile | On Friday, 26 February 2016 at 04:21:15 UTC, BBasile wrote:
> On Friday, 26 February 2016 at 04:19:29 UTC, BBasile wrote:
>> static if (__traits(isStaticFunction,typeof(m2)))
>>
>> static if (__traits(isStaticFunction, __traits(getMember, vulkan_input, m2))))
>
> Sorry don't copy paste like this there's a superfluous right paren.
>
> static if (__traits(isStaticFunction, __traits(getMember, vulkan_input, m2)))
thanks
Nic
|
Copyright © 1999-2021 by the D Language Foundation