Does anyone know why the new variables don't show up after the static foreach?

I have a struct, it has some marked fields. I want to note those fields at compile time and make some similarly named fields like myField becomes myField__replicated.

The code doesn't _have_ to be inside the struct/class itself. It could be:
```
auto replicatedObject = makeReplicated!(myObject);
```
for example.

I'm not sure the high-level best way right now, as I'm currently having issues with the nitty-gritty implementation of templates.




snippetcode (drop right into run.dlang.io):
```D
import std;

struct multiplayerObject2
        {
        ushort type;
        ushort type2;
        float x, y;
        
        static foreach(t; typeof(this).tupleof)
                {
                pragma(msg, t.stringof);
mixin("bool " ~ t.stringof ~ "25;"); // copy the fieldname with a suffix
                }

        pragma(msg, "-----separator-----");

        static foreach(t; typeof (this).tupleof) // again
                {
                pragma(msg, t.stringof); // does not see any new fields!
                }
        }

void main()
{

}
```



```D
// Output
type
type2
x
y
-----separator-----
type
type2
x
y
```

Reply via email to