Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- import core.atomic;
- import core.thread;
- import core.sync.mutex;
- import std.datetime.stopwatch;
- import std.concurrency;
- import std.traits;
- import std.random;
- import std.algorithm;
- import std.conv;
- struct Ref{
- string n;
- };
- struct E {}
- struct A {
- int a;
- @Ref("a")
- E b;
- E c;
- E c1;
- E c2;
- E c3;
- void print() {
- static foreach(i, m; A.tupleof)
- static if (hasUDA!(m, Ref)) {{
- immutable auto n = getUDAs!(m, Ref)[0].n;
- __traits(getMember, this, n) *= 2;
- }}
- }
- }
- void main()
- {
- writeln("A.sizeof ", A.sizeof);
- auto a = A(1);
- writeln(a);
- a.print();
- writeln(a);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement