clear works better than it ought to considered i never defined it

Vlad Levenfeld via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 27 23:27:43 PDT 2014


A weird thing happened:

I was building a dictionary struct which contains a custom array 
of values and a differently-typed custom array of keys. Both of 
them implicitly define "clear" by aliasing a backing array.

The dictionary type doesn't have clear, though. And it doesn't 
alias anything. Yet when I call clear on it, not only does it 
work, but it clears both of the private contained arrays. I can't 
find any free clear function in Phobos.

Not that I'm complaining, but... what's going on here?


More information about the Digitalmars-d-learn mailing list