C function to a Selector ?
C function to a Selector ?
- Subject: C function to a Selector ?
- From: Aurélien Hugelé <email@hidden>
- Date: Fri, 23 Apr 2004 10:42:57 +0200
hi !
i have *a lots* of C functions defined as this :
static int _ascendingFirstNameOrder(id firstElt,id secondElt);
static int _ascendingLastNameOrder(id firstElt,id secondElt);
...
I m coding a sort of autosortedArray using binary search to sort items
as they are inserted in the array.
by default the selector will be @selector(compare:), but can be changed
using a sort of setSelector:
I can't honestly convert all the previous C function to selector by
rewritting them, it would be *VERY* long...
so basically i want my autosortedArray to be based on selector. You
would be able to init the autosortedArray with a Selector OR a C
function. At init, the class would transform the C function to the
matching selector...
i have looked at NSInvocation etc.. but it is incomprehensible, at
least for me !
could someone give me an example to convert one of those C function
above to a simple selector, something that could be used like this :
[firstElt ascendingFirstName:secondElt];
thanks !
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.