弱引用的简写原理[由来]

2018-07-10  本文已影响10人  lanmoyingsheng
// 普通写法
__weak ClassName *weakObj = obj;

// 进化成这样
// typeof(obj)的值为 SomeObject *,是有*的。
__weak typeof(obj) weakObj = obj; 

// 宏
#define WeakType(type)  __weak typeof(type) weak##type = type

上一篇 下一篇

猜你喜欢

热点阅读