Container hierarchy vs. container types

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 5 13:29:46 PST 2010


On Fri, 05 Mar 2010 16:16:15 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Steven Schveighoffer wrote:
>>  It depends on what you want to do with the container.  std.algorithm  
>> is not the only reason to have containers.
>
> It's not the only reason, but it is the primordial reason - just like  
> "transportation" is a reason for buying a car. It would be a failure to  
> define containers that can't work with std.algorithm.

I disagree.  I generally use containers for collecting items for later  
lookup.  That's generally a container-specific function that can be part  
of an interface.  Other functions I usually use are iteration, which again  
can be part of the interface.

Besides, making containers have interfaces does not preclude them from  
using std.algorithm.  I agree std.algorithm is definitely a reason to have  
containers, but that's not mutually exclusive with interfaces.

-Steve



More information about the Digitalmars-d mailing list