On Thursday, 20 January 2022 at 01:14:51 UTC, Adam Ruppe wrote:
On Thursday, 20 January 2022 at 00:55:33 UTC, Jack Stouffer
wrote:
static foreach(member; __traits(allMembers,
Manager))
member here is a string, not the member. I prefer to call it
memberName.
Then you
On Thursday, 20 January 2022 at 00:55:33 UTC, Jack Stouffer wrote:
static foreach(member; __traits(allMembers,
Manager))
member here is a string, not the member. I prefer to call it
memberName.
Then you __traits(getMember, Manager, memberName) to actually get
the alias you can
On Wednesday, 19 January 2022 at 21:49:12 UTC, Adam D Ruppe wrote:
I never use most of std.traits, they just complicate things.
Bleh idk, I wouldn't bother with it and loop through the
__traits instead.
Unless I'm missing something obvious this has to be a DMD bug,
because this prints
On Wednesday, 19 January 2022 at 21:44:57 UTC, Jack Stouffer
wrote:
The error is actually coming from trying to use the result of
getSymbolsByUDA in the right part of the `static foreach`
huh..
I never use most of std.traits, they just complicate things. Bleh
idk, I wouldn't bother with
On Wednesday, 19 January 2022 at 20:53:29 UTC, Adam D Ruppe wrote:
So you want to `__traits(child, system, this).run()` and it
should work - the traits child will re-attach a this value.
The error is actually coming from trying to use the result of
getSymbolsByUDA in the right part of the
On Wednesday, 19 January 2022 at 20:46:17 UTC, Jack Stouffer
wrote:
static foreach(system; getSymbolsByUDA!(Manager,
Runnable))
{
system.run();
onlineapp.d(16): Error: value of `this` is not known at compile
time
The getSymbols returns aliases, meaning you hit
I'm trying to use getSymbolsByUDA in order to loop over all of
the members in a struct with a certain UDA, and then call a
function on the member. The plan is to use this to avoid looping
over an array of function pointers.
However, the compiler is giving a strange error and the