Non-recursive maxSizeOf

Adam D. Ruppe destructionator at
Thu Aug 6 01:13:41 UTC 2020

On Thursday, 6 August 2020 at 00:58:39 UTC, Per Nordlöw wrote:
> Is it possible to implement
> in a non-recursive way?

It is very easy too... just write an ordinary function:

size_t maxSizeOf(T...)() {
         size_t max = 0;
         foreach(t; T)
                 if(t.sizeof > max)
                         max = t.sizeof;
         return max;

pragma(msg, maxSizeOf!(int, char, long));

More information about the Digitalmars-d-learn mailing list