09-Jan-2013 03:37, Joseph Rushton Wakeling пишет:
On 01/08/2013 10:43 PM, Jonathan M Davis wrote:
std.container.Array and built-in arrays are _very_ different. Array is a
container, not a range. You can slice it to get a range and operate on
that,
but it's not a range itself.

Is there a particular reason why Array can't have a range interface itself?


Of course, there is - it then will have to keep around the head pointer or to truly remove say front element by shift the rest of the array. Aside from awful implementation contortions it probably can be done but I'd strongly argue against it.

On the other hand, built-in arrays aren't true containers. They don't
own or
manage their own memory in any way, shape, or form, and they're ranges.

Forgive the naive question, but what _is_ the definition of a 'true
container'?  Is managing its own memory a necessary component?

Managing its own memory is required for container.
Ranges don't manage memory they don't have insert/delete whatever.
Built-in arrays are strange beasts but for good reason.

Or just
for D's concept of a container?


--
Dmitry Olshansky

Reply via email to