std.container & ranges
Mike Parker
aldacron at gmail.com
Sun Oct 30 20:11:45 PDT 2011
On 10/31/2011 5:28 AM, Jonathan M Davis wrote:
>
> So, in comparison to C++, there's no significant difference. Now, Java does have
> a remove function which will take an element and remove the first occurence of
> that element from a list, and we could theoretically add one, but why?
IMO, it's much more intuitive to say list.remove(item). It's the first
thing a lot of people expect coming from a Java background, that's for
sure. The first time I tried to use SList, being unfamiliar with ranges
as I was, it took a while to figure out what I needed to do. IIRC, I had
to post here to ask.
The problem is that you really have to understand ranges and the Phobos
functions that manipulate them before you can begin to use containers. I
think that's wrong. Ideally, containers should be usable without having
to know about find and Take and whatever else. This isn't the first time
this question has come up in the NG and I've got a feeling it won't be
the last.
At the very least it would be nice to see something in the documentation
tying std.algorithm and std.range together with std.container. Something
to point the way for those to whom it isn't obvious.
More information about the Digitalmars-d-learn
mailing list