October 02, 2015 Re: Checking that a template parameter is an enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Thursday, 1 October 2015 at 22:37:57 UTC, Ali Çehreli wrote:
> template allSame(V...)
> if (isExpressions!(V))
> {
> bool impl_(V...)() {
> static if (V.length > 1) {
> foreach (i, _; V[0 .. $ - 1]) {
> if (V[i] != V[i + 1]) {
> return false;
> }
> }
>
> return true;
>
> } else {
> return true;
> }
> }
>
> enum allSame = impl_!V();
> }
Will proposed `static foreach` reduce number of instantiations here?
|
October 02, 2015 Re: Checking that a template parameter is an enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Friday, 2 October 2015 at 07:52:22 UTC, Nordlöw wrote:
> On Friday, 2 October 2015 at 02:39:56 UTC, Meta wrote:
>> Highly doubtful as CTFE already allocates like there's no tomorrow.
>
> Could that memory usage be tested somehow?
Your favourite process monitor I guess.
|
October 02, 2015 Re: Checking that a template parameter is an enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On Friday, 2 October 2015 at 16:21:22 UTC, Meta wrote:
>> Could that memory usage be tested somehow?
>
> Your favourite process monitor I guess.
Any suggestions on an evil D snippet that stress tests different implementations of the above mentioned traits?
|
October 02, 2015 Re: Checking that a template parameter is an enum | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Friday, 2 October 2015 at 18:52:22 UTC, Nordlöw wrote:
> On Friday, 2 October 2015 at 16:21:22 UTC, Meta wrote:
>>> Could that memory usage be tested somehow?
>>
>> Your favourite process monitor I guess.
>
> Any suggestions on an evil D snippet that stress tests different implementations of the above mentioned traits?
I don't know off the top of my head, but I remember somebody on these forums mentioning a certain CTFE program that caused DMD to take up over 100GB in RAM before the process was killed.
|
Copyright © 1999-2021 by the D Language Foundation