Re: sort!("...") with template function?

2019-02-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, February 26, 2019 3:06:04 AM MST Simen Kjærås via Digitalmars-d- learn wrote: > On Monday, 25 February 2019 at 15:26:33 UTC, Jonathan M Davis > > wrote: > > On Monday, February 25, 2019 5:47:47 AM MST Simen Kjærås via > > > >> String functions can't access the local scope, and thus

Re: sort!("...") with template function?

2019-02-26 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 25 February 2019 at 15:26:33 UTC, Jonathan M Davis wrote: On Monday, February 25, 2019 5:47:47 AM MST Simen Kjærås via String functions can't access the local scope, and thus can't see Dummy. Using lambdas works. (string functions were basically a workaround for no decent lambda

Re: sort!("...") with template function?

2019-02-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 25, 2019 5:47:47 AM MST Simen Kjærås via Digitalmars-d- learn wrote: > On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm > > wrote: > > Hello. > > > > I wish to sort an array by calling a template function on a > > struct. In essence I want to do > > > >

Re: sort!("...") with template function?

2019-02-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:47:47 UTC, Simen Kjærås wrote: On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get

Re: sort!("...") with template function?

2019-02-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:47:50 UTC, Andrea Fontana wrote: On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I

Re: sort!("...") with template function?

2019-02-25 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get the error message

Re: sort!("...") with template function?

2019-02-25 Thread Andrea Fontana via Digitalmars-d-learn
On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm wrote: Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get the error message

sort!("...") with template function?

2019-02-25 Thread Vladimirs Nordholm via Digitalmars-d-learn
Hello. I wish to sort an array by calling a template function on a struct. In essence I want to do foos.sort!("a.get!Dummy < b.get!Dummy"); but I get the error message /dlang/dmd/linux/bin64/../../src/phobos/std/functional.d-mixin-215(215): Error: undefined identifier Dummy Is