Skip to content

Instantly share code, notes, and snippets.

@farcaller
Created February 9, 2009 21:47
Show Gist options
  • Save farcaller/61031 to your computer and use it in GitHub Desktop.
Save farcaller/61031 to your computer and use it in GitHub Desktop.
+ (id)dictionaryWithObjectsAndKeys:(id)firstObject, ...
{
// XXX: duplicate implementation is bad, but so it's done in CPArray
// The arguments array contains self and _cmd, so the first object is at position 2.
debugger;
var d = [self alloc];
var arglist = [d, "initWithObjectsAndKeys:"];
for(var i = 2; i<arguments.length; ++i)
arglist[i] = arguments[i];
var methodImpl = class_getInstanceMethod(self, "initWithObjectsAndKeys:").method_imp;
return methodImpl.apply(d, arglist);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment