Two questions

IM 3di at gm.com
Wed Jan 2 17:38:41 UTC 2019


1- How do I do in D the equivalent of the following C++ macro?

#define OUT_VAL(val) (count << #val << " = " << val << endl)

In particular the #val above to the actual macro argument as a 
string?

2- Yesterday I was experimenting with something and I wrote 
something like the following:

struct MyType {
   ...
}

void doSomeWork(ref MyType o) {
    ...
}

auto t = MyType(...);

t.doSomeWork(); // <-- failed to compile.

Why did the above UFCS call fail to compile? I had to do 
doSomeWork(t) instead.

Thank you so much!


More information about the Digitalmars-d-learn mailing list