Access template parameters at runtime

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Aug 10 14:17:04 PDT 2012


On 8/10/12, Dmitry Olshansky <dmitry.olsh at gmail.com> wrote:
> Internally identical to:
>
> int opIndex(size_t idx)
> {
> 	return [integers][idx];
> }
>
> Allocates on every call or not? I've no idea maybe Kenji fixed this
> already.

t's easy to check, add "writeln(&ints[idx]);" in opIndex and index [0]
several times. If the addresses change it means it allocates. It does
allocate every time when it's an enum but not if it's static.


More information about the Digitalmars-d mailing list