manual memory management

deadalnix deadalnix at gmail.com
Tue Jan 8 21:46:54 PST 2013


On Wednesday, 9 January 2013 at 00:50:29 UTC, Jonathan M Davis 
wrote:
> On Wednesday, January 09, 2013 00:37:10 Joseph Rushton Wakeling 
> wrote:
>> 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?
>
> It's a container. Turning a container into a range is just 
> begging for
> trouble. For instance, what happens when you iterate over it? 
> You remove all
> of its elements, because you keep calling popFront on it. 
> Making a container
> into a range is an incredibly bad idea. Things are already 
> weird enough with
> the built-in arrays.
>

It seems to me like a container should be able to provide a range 
to iterate its content (but yeah, the container shouldn't be the 
range itself).


More information about the Digitalmars-d mailing list