sortUniq

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 23 09:48:55 PST 2015


On Fri, Jan 23, 2015 at 09:40:42AM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
> On 1/23/15 7:04 AM, zeljkog wrote:
> >On 22.01.15 22:40, Andrei Alexandrescu wrote:
> >>There's this classic patter on Unix: |sort|uniq, i.e. sort some data
> >>and only display the unique elements.
> >>
> >
> >Loosely-related, compiling
> >
> >...
> >auto ret = arr.filter!(myFilter());
> >...
> >
> >I got:
> >
> >Error: closures are not yet supported in CTFE
> >
> >Using struct with opCall directly also does not pass.
> >
> >Did I miss something?
> >Is it near?
> 
> Must be you put that code at top level and the compiler tried to
> interpret it during compilation. -- Andrei

I think what he's trying to do is to call a function that returns a
delegate, and use that delegate to instantiate the filter template.
AFAIK I've never seen code like this before, and it looks like the
compiler isn't prepared to handle this.


T

-- 
I am not young enough to know everything. -- Oscar Wilde


More information about the Digitalmars-d mailing list