Why is std.algorithm so complicated to use?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 10 10:55:32 PDT 2012


On 7/10/12 12:57 PM, Jacob Carlborg wrote:
> On 2012-07-10 16:36, Dmitry Olshansky wrote:
>> Dunno, to me it says SORTED in one big scary thought. Again it should
>> ether check constraint or put some more useful description. e.g.
>> "(functionality akin to the uniq system utility)" doesn't strike me as
>> helpful.
>
> Sure, this particular example uses a sorted array, but nothing says an
> unsorted array won't work.

Clearly this and any documentation can be improved, but I'd say if it 
says "range" there there's no assumption "sorted range" there. I think 
the main thing that could be expressed better is "unique consecutive".

> Does it only handle ints. It doesn't say anything about that in the
> documentation and the example uses ints. Then it must only accept ints.

I think it would be onerous to mention for each algorithm, although 
clearly they all are generic, that they can handle ranges with any 
element type.

> You see how stupid that is.

That being what?


Andrei


More information about the Digitalmars-d mailing list