Non-recursive maxSizeOf

Per Nordlöw per.nordlow at gmail.com
Thu Aug 6 11:44:45 UTC 2020


On Thursday, 6 August 2020 at 01:13:28 UTC, Ali Çehreli wrote:
> Boring in D. :p
>
> template maxSizeOf(T...) {
>   enum maxSizeOf = compute();
>
>   auto compute() {
>     size_t result;
>     static foreach (t; T) {
>       if (t.sizeof > result) {
>         result = t.sizeof;
>       }
>     }
>     return result;
>   }
> }

Thanks. I'm gonna benchmark this against my templated solution.


More information about the Digitalmars-d-learn mailing list