Re: Access Violation in callback from sort

2013-03-21 Thread Ali Çehreli
On 05/02/2012 08:27 AM, Jabb wrote: > Alone this works just fine. But if I add another file called myalgs.d, > and put the following in it: > > //-- > module myalgs; > import std.algorithm; > //-- > > Then I get the following exception: > > object.Error: Access Vio

Re: Access Violation in callback from sort

2013-03-21 Thread Ali Çehreli
On 03/21/2013 01:02 PM, Stefan wrote: > On Wednesday, 2 May 2012 at 15:27:58 UTC, Jabb wrote: > >> import std.algorithm; >> void main() { >> uint[string] counts = [ "a":4, "b":5, "c":3, "d":1 ]; >> string[] keys = counts.keys; >> >> sort!((a, b) { return counts[a] > counts[b]; })(keys); >> } > > D

Re: Access Violation in callback from sort

2013-03-21 Thread Stefan
On Wednesday, 2 May 2012 at 15:27:58 UTC, Jabb wrote: import std.algorithm; void main() { uint[string] counts = [ "a":4, "b":5, "c":3, "d":1 ]; string[] keys = counts.keys; sort!((a, b) { return counts[a] > counts[b]; })(keys); } Did you try string[] keys = counts.keys

Re: Access Violation in callback from sort

2012-05-03 Thread Steven Schveighoffer
On Wed, 02 May 2012 11:27:57 -0400, Jabb wrote: Just got the TDPL book and it's a great read! I learn best when typing out the code myself, so I decided to make a single VisualD project and put the different exercises in separate modules. I am having problems with sort in std.algorithms -

Access Violation in callback from sort

2012-05-02 Thread Jabb
Just got the TDPL book and it's a great read! I learn best when typing out the code myself, so I decided to make a single VisualD project and put the different exercises in separate modules. I am having problems with sort in std.algorithms - well, actually it appears to be a closure problem whe