我试图理解这段代码。我一直在弄清楚为什么d
和e
是int*
和const int*
。我可以使用一些帮助。
const int ci = i, &cr = ci;
auto b = ci; // b is an int (top-level const in ci is dropped)
auto c = cr; // c is an int (cr is an alias for ci whose const is top-level)
auto d = &i; // d is an int*(& of an int object is int*)
auto e = &ci; // e is const int*(& of a const object is low-level const)
答案 0 :(得分:5)
UIImagePickerControllerSourceTypeCamera
表示“取- (void)channel:(SBDBaseChannel *)sender didReceiveMessage:(SBDBaseMessage *)message
的地址。由于&i
是i
,因此i
的类型为int
。由于automatic type deduction rules,&i
的类型推断为int*
。
同样的推理可以适用于d
。唯一的区别是int*
限定符。