How do i successfully use std.functional.binaryFun in the following example?

import std.stdio;
import std.functional;

class Foo(T, alias greater = "a > b") if (is(typeof(binaryFun!(greater)(T.init, T.init)) == bool))
{
        private alias compare = binaryFun!(greater);

        public this()
        {
                writefln("%s", this.compare(2, 1));
        }
}

void main(string[] args)
{
        auto foo = new Foo!(int, "a < b"); // Works

auto bar = new Foo!(int, delegate(int a, int b){ return a > b; }); // Linker error.
}

The first instantiation works when using a string but I get a linker error when i try and use a delegate as the compare function. Why is this? and what do i need to do to correct this?

Reply via email to