c++ - Creating an immutable CFArray object - Apple sample doesn't work -


for testing copied following sample code [https://developer.apple.com/library/ios/documentation/corefoundation/conceptual/cfcollections/articles/creating.html] , compiled it:

#import <corefoundation/corefoundation.h>  cfstringref strs[3]; cfarrayref anarray;  strs[0] = cfstr("string one"); strs[1] = cfstr("string two"); strs[2] = cfstr("string three");  anarray = cfarraycreate(null, (void *)strs, 3, &kcftypearraycallbacks); 

now got following error: "no matching function call cfarraycreate"

why not compilable , how implement it compilable?

the type of second parameter of cfarraycreate() const void **. so, change call to:

anarray = cfarraycreate(null, (const void **)strs, 3, &kcftypearraycallbacks); 

this problem in c++, because lot stricter converting , void*. in c, void* converts other pointer types freely.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -