std.container update - now Array is in

Steven Schveighoffer schveiguy at yahoo.com
Fri May 28 13:01:54 PDT 2010


On Fri, 28 May 2010 15:51:53 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu  
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>>
>> http://erdani.com/d/phobos/std_container.html
>> http://erdani.com/d/phobos/container.d
>>
>> I defined Array as a straightforward implementation of the homonym  
>> abstraction. There are a few imperfect corners, but by and large I'm  
>> starting to believe it's becoming possible to write certain  
>> cross-container codes.
>
>
> I just noticed, there is no doc for ElementType, only ValueType and  
> KeyType.


Also, ElementType is also a template in std.range, can we change one of  
these?  I would use the following condition to accept a range:


struct container(T)
{

    void add(R)(R r) if (isInputRange!R &&  
isImplicitlyConvertible(ElementType!R, T)
}

But I think if container(T) defines ElementType, the compiler will be  
confused...

-Steve


More information about the Digitalmars-d mailing list