だから、私はNSArraysたくさん使うので、私はここにマクロをもとに、渡されたプリミティブから配列を作成するマクロを作成しようとすることを決めた。だから、基本的に オートボックスNSArray?
#define $array(values...) ({ void *v[] = { values }; const char *encodings[] = { /* how do I get the @encode-ings for each? */ }; _boxArray(v, encodings, sizeof(values)/sizeof(void *))})
NSValue *_box(void *value, const char *encoding); // defined by CollectionUtils
NSArray *_boxArray(void **values, const char **encodings, int count)
{
id objects[count];
for (int i = 0; i < count; i++) {
// how can I box all of the values that need boxing?
objects[i] = _box(values[i], encodings[i]);
}
return [NSArray arrayWithObjects:objects count:count];
}
https://bitbucket.org/snej/myutilities/src/319441e240fa/CollectionUtils.h
、私が求めているのは、どのように私はvariadicマクロを使って、マクロに渡される各引数に対して操作を実行できますか?
ナッシング:
は、ルックをお持ちですか? –