Max/Min values in an associative array
Martijn Pot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 6 11:05:49 PDT 2014
On Wednesday, 6 August 2014 at 17:57:55 UTC, TJB wrote:
> I am trying to find the max and min values in an associative
> array. Say I have:
>
> double[char] bids;
> bid['A'] = 37.50;
> bid['B'] = 38.11;
> bid['C'] = 36.12;
>
> How can I find the max and min values. I am thinking that I
> need to use max and min functions from std.algorithm, but not
> sure how to.
>
> Thanks!
> TJB
You can extract the values into a double[] using bid.values. Then
you can simply use max and min from std.algorithm.
More information about the Digitalmars-d-learn
mailing list