amparacha:

Such questions are better asked in the D.learn newsgroup.

I am having error when using pointers to functions with argument of type T.This is a small portion of a program doing a generic quick sort by passing a comparison function as an argument.

import std.stdio;

bool comp(T)(T left, T right) {
    // some comparison criteria
    return false;
}

int partition(T)(T[] list,
                 bool function(T val1, T val2) f,
                 int left,
                 int right) {
    return 2;
}

void sort(T)(T[] list, int left, int right) {
    int spiltPoint;
    bool function(T val1,T val2) ptr = ∁
    spiltPoint = partition(list, ptr, left, right);
}

void main() {}

Bye,
bearophile

Reply via email to