dsimcha wrote:
I almost never do this with any data structure other than an array because, even if it works for now, I consider it a horrible violation of encapsulation because you're relying on the details of how the data structure manipulates memory. This is also why, when I designed RandAA I didn't see this as an issue until you pointed it out to me.
Andrei is working on the design of the D collection class library. After much thought and research, he finally came to the conclusion that a collection class should not allow the address of a member to be taken. I think his reasoning on the issue is pretty sound, and is consistent with your take on it.
