RFC on range design for D2

jq jlquinn at optonline.net
Thu Jan 8 16:00:43 PST 2009


dsimcha Wrote:

> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article

> > The idea is very simple: just use D's native append operation, but cache
> > the capacity to avoid too many lookups (I understand that that's the
> > bottleneck).
> > I paste the code below, I'd be indebted if you guys grabbed it and
> > tested it.
> > Andrei
> > struct ArrayAppender(T)
> > {
> >      size_t capacity() const { return _capacity; }
> >      void putNext(T item)

I have thoughts:

1) There should probably be a length/size call
2) How about add() or append() for a shorter name
3) What about using ~=?  Maybe this is too short...

Jerry


More information about the Digitalmars-d-announce mailing list