Re: Finding the index of the maximum value in an associative array

2017-06-01 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 18:05:07 UTC, H. S. Teoh wrote: On Tue, May 30, 2017 at 05:57:04PM +, Lyle via Digitalmars-d-learn wrote: Hi, I have an associative array of type int[ulong] and I'm trying to get the index of the maximum value, like this: int[ulong] aa = [1UL: 2000,

Re: Finding the index of the maximum value in an associative array

2017-05-30 Thread Lyle via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 18:05:02 UTC, cym13 wrote: On Tuesday, 30 May 2017 at 17:57:04 UTC, Lyle wrote: Hi, I have an associative array of type int[ulong] and I'm trying to get the index of the maximum value, like this: int[ulong] aa = [1UL: 2000, 2UL: 5000,

Re: Finding the index of the maximum value in an associative array

2017-05-30 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, May 30, 2017 at 05:57:04PM +, Lyle via Digitalmars-d-learn wrote: > Hi, > > I have an associative array of type int[ulong] and I'm trying to get > the index of the maximum value, like this: > > int[ulong] aa = [1UL: 2000, > 2UL: 5000, > 5UL: 1000]; >

Re: Finding the index of the maximum value in an associative array

2017-05-30 Thread cym13 via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 17:57:04 UTC, Lyle wrote: Hi, I have an associative array of type int[ulong] and I'm trying to get the index of the maximum value, like this: int[ulong] aa = [1UL: 2000, 2UL: 5000, 5UL: 1000]; writeln(aa.maxIndex); // should print

Finding the index of the maximum value in an associative array

2017-05-30 Thread Lyle via Digitalmars-d-learn
Hi, I have an associative array of type int[ulong] and I'm trying to get the index of the maximum value, like this: int[ulong] aa = [1UL: 2000, 2UL: 5000, 5UL: 1000]; writeln(aa.maxIndex); // should print 2 Can anyone help me out? Many thanks, Lyle