Make std.container.Array an output range

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 6 00:31:58 PDT 2014


05-Jun-2014 17:51, Rene Zwanenburg пишет:
> I depend heavily on RAII in a project I'm working on. Since structs in
> dynamic arrays never have their destructors called I'm using Array!T
> instead. A pattern that comes up often is that I have some input range
> of T's which need to be stored in a member Array!T. However Array is not
> an output range so I can't use
>
> inputRange.copy(someArray);
>
> I understand the difference between a container and a range iterating
> over that container. However I do think a container is an output range.
>
> Should I file an enhancement request or is there something fundamentally
> wrong with this idea? For Array it should be as simple as adding
>
> alias doPut = insertBack;

I think we all understand that not every container has one and holy 
insertion policy. How about adding Array.backInserter ?


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list