On Jul 1, 2011, at 5:50 AM, Appa Rao Mulpuri wrote:

> Is there any way to put the NSComparator pointers into Dictionary? I have
> tried put NSValue using [NSValue valueWithPointer:] , but giving me nil in
> get operation.

An NSComparator is a type of block, and blocks can be directly used as 
Objective-C objects. The only thing is that you have to copy the block first, 
if you’re going to use it after the containing function exits. So:

NSComparator cCopy = [comparator copy];
[myDict setObject: cCopy forKey: @“comparator”];
[cCopy release];

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to