NSUUID effectively wraps uuid_t.
Decision...
@implementation NSUUID ( Compare ) - ( NSComparisonResult ) compare : ( NSUUID * ) that { uuid_t x; uuid_t y; [ self getUUIDBytes : x ]; [ that getUUIDBytes : y ]; const int r = memcmp ( x, y, sizeof ( x ) ); if ( r < 0 ) return NSOrderedAscending; if ( r > 0 ) return NSOrderedDescending; return NSOrderedSame; } @end
source share