On 8/6/20 4:44 AM, Per Nordlöw wrote:
On Thursday, 6 August 2020 at 01:13:28 UTC, Ali Çehreli wrote:Boring in D. :ptemplate 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.
I guess an anonymous function would remove the need for that creative name. :)
enum maxSizeOf = { // ... }(); Ali