4

I was looking through some Apple sample code for their 2014 WWDC session 'Advanced User Interfaces with Collection Views' and came across a weakself declaration that looked like the following:

__weak typeof(&*self) weakself = self;

My question is: what do the &* mean in the declaration? Why not just have:

__weak typeof(self) weakself = self;

Thanks for your help.

4

2 回答 2

0

为什么不只是有:

__weak typeof(self) weakself = self;

你可以。这是正常的做法。一些以前版本的编译器没有正确处理它,但很久以前就修复了。

于 2014-07-04T23:33:56.747 回答
-1

self是一个MyInstance *。当你说*self的时候,你是在取消对self*返回的引用self。然后,当您使用时,&(*self)您将获取内存地址。

于 2014-07-04T04:19:31.543 回答