We need to rethink remove in std.container

Steven Schveighoffer schveiguy at yahoo.com
Wed Feb 23 06:55:40 PST 2011


On Wed, 23 Feb 2011 01:30:49 -0500, Philippe Sigaud  
<philippe.sigaud at gmail.com> wrote:

> On Tue, Feb 22, 2011 at 23:20, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>>
>> s/insert/put
>>
>> Now all containers that support insertion are output ranges...
>>
>> Or am I missing something?
>
> I mean that, in the same way that a container can expose its elements
> as an input range using [], a partially filled container could give
> access to its empty 'slots' (created by 'reserve()' ) via an output
> range.

Oh, that's easy.  Any container range that allows setting front elements  
is fair game.

For example SList's range can be an output range right now.  (I believe  
isOutputRange!(SList.init[]) should be true)

What's not available is adding new elements to a container via the output  
range concept.

-Steve


More information about the Digitalmars-d mailing list