【发布时间】:2020-06-30 06:42:23
【问题描述】:
函数期待 CFDictionaryRef 返回:
CFDictionaryRef xyz()
{
CFMutableDictionaryRef test = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(test, CFSTR("Test"), CFSTR("Test"));
return reinterpret_cast<CFDictionaryRef>(test);
}
可以使用 reinterpret_cast 进行转换吗?给我一个空指针。
【问题讨论】:
-
你不能直接返回
test吗?可变字典是字典的子类。
标签: c++ ios objective-c core-foundation reinterpret-cast