On Saturday, 3 June 2017 at 13:17:46 UTC, Russel Winder wrote:
A stripped down problem to avoid fluff. The C macro:

    #define FLOB(t) (sizeof(t))

Can be used in another macro:

    #define THINGY(a, b) (_THING(a, FLOB(b)))

We can use this as in:

    THINGY(10, __u32)

Now the D Way says use functions not macros. except that

    size_t FLOB(T)(auto ref T t) { return t.sizeof; }

which is the result of DStep doesn't allow passing a type name as t.

Is this a problem in D or a problem in DStep?

I think an alias template parameter will work here as aliases take anything(types, literals, symbols).

Reply via email to