So... add maxCount and maxPos?

tn via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 21 03:24:51 PST 2016


On Thursday, 21 January 2016 at 01:11:19 UTC, Andrei Alexandrescu 
wrote:
> On 01/20/2016 04:22 PM, Ivan Kazmenko wrote:
>> 2. The index of minimum or maximum element, mostly using plain 
>> array as
>> a range.  I write "a.length - a.minPos.length", and it looks 
>> completely
>> unintuitive.  Additionally, when compiling to 64 bits, I 
>> usually still
>> want an int to use with other ints around (longs are overkill 
>> most of
>> the time), and the cast adds more clobber.  Again, is there a 
>> better way
>> to express that?
>
> No better way currently. We could add (min|max)Index but I like 
> (min|max)Pos quite a bit. They offer more flexibility for 
> non-random access ranges.

But (min|max)(Index|Key) offer different type of flexibility as 
those make sense for associative containers.


More information about the Digitalmars-d mailing list