Runtime heterogeneous collections?

Steven Schveighoffer schveiguy at gmail.com
Fri Jan 18 15:24:08 UTC 2019


On 1/18/19 10:10 AM, Neia Neutuladh wrote:
> On Fri, 18 Jan 2019 10:07:41 -0500, Steven Schveighoffer wrote:
>> But what is the common interface between those 2 types? Even in
>> Dcollections, where RedBlackTree came from, there was no interfaces that
>> didn't specify the type they were dealing with. In other words, there is
>> no common interface for sets of 2 different types.
> 
> ..empty(), .clear(), .length(), and .toString(sink, formatspec). Which is
> kind of anemic. Might as well use Object.
> 

Yeah, I didn't bother with any of those as base interfaces. Probably the 
most basic interface for dcollections was Iterator(V):

https://github.com/schveiguy/dcollections/blob/master/dcollections/model/Iterator.d#L40-L58

-Steve


More information about the Digitalmars-d-learn mailing list