C++17 cannot beat D surely
Ali Çehreli via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 6 20:06:34 PDT 2017
On 06/06/2017 06:09 PM, Steven Schveighoffer wrote:
> But it is pretty well known that enum'ing an array can have it allocate
> wherever it is used.
One of the most effective examples is comparing .ptr with (seemingly)
itself:
void main() {
enum e = [ 1 ];
static assert(e.ptr != e.ptr);
assert(e.ptr != e.ptr);
}
Both asserts pass. I'm surprised that e.ptr is usable at compile time.
Fine, I guess... :)
Ali
More information about the Digitalmars-d
mailing list