Non-recursive maxSizeOf
Per Nordlöw
per.nordlow at gmail.com
Thu Aug 6 01:19:12 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;
> }
> }
I forgot to say that I was looking for a solution that used
`static foreach` but doesn't trigger CTFE...
More information about the Digitalmars-d-learn
mailing list