Function Pointers with Type T

amparacha via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 15 09:28:16 PDT 2014


Can anyone looks at the following code to fix it.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;


int main(){

return 0;
}

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


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

int partition(T)(T[]list,bool function(T)(T val1,T val2)ptr,int 
left,int right){

return 2;

}


More information about the Digitalmars-d mailing list