-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Permalink
Choose a base ref
{{ refName }}
default
Choose a head ref
{{ refName }}
default
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also or
learn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Learn more about diff comparisons here.
base repository: ChenYilong/iOSInterviewQuestions
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
...
head repository: liruqi/iOSInterviewQuestions
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
- 16 commits
- 3 files changed
- 1 contributor
Commits on Oct 29, 2015
-
文中的 `- deepCopy` 方法并不能实现深拷贝。 `CYLUser` 的 `- copyWithZone` 方法里,`_friends` 成员的的赋值使用的 `- mutableCopy` 是浅拷贝,只是创建了`NSMutableSet` 对象;导致 `- deepCopy`方法中, _friends 的每一个对象的 _friends 列表并未创建实例。 为了测试 `NSArray`, `NSSet` 容器类初始化行为,我写了测试代码, ``` NSMutableArray *objects = [NSMutableArray array]; [objects insertObject:[NSDate date] atIndex:0]; if ([objects count] > 0) { NSArray *arr = [[NSArray alloc] initWithArray: objects]; for (int i=0; i<arr.count; i++) { NSLog(@"%d %x %x", i, (uint) objects[i], (uint)arr[i]); } NSMutableSet* set = [[NSMutableSet alloc] initWithArray: objects]; NSMutableSet* setcopy = [set mutableCopy]; NSLog(@"set 1: %@ %x", set, (uint) [set allObjects][0]); NSLog(@"set 2: %@ %x", setcopy, (uint) [setcopy allObjects][0]); } ``` 执行结果: ``` 2015-10-29 17:44:29.240 NSSpec[12024:438388] 0 2a43ec60 2a43ec60 2015-10-29 17:44:29.241 NSSpec[12024:438388] set 1: {( 2015-10-29 09:44:26 +0000 )} 2a43ec60 2015-10-29 17:44:29.241 NSSpec[12024:438388] set 2: {( 2015-10-29 09:44:26 +0000 )} 2a43ec60 ```
Configuration menu - View commit details
-
Copy full SHA for e71a4b1 - Browse repository at this point
Copy the full SHA e71a4b1View commit details -
首先,if 的确比对象 copy 要快。 另外,判断对象是否相同是为了保证代码执行的正确性。在非 ARC 环境下,如果穿入对象 retain count 为 1,不做判断的话,release 之后对象内存释放,下一步 copy 也会出错。
Configuration menu - View commit details
-
Copy full SHA for 4127d6b - Browse repository at this point
Copy the full SHA 4127d6bView commit details -
Merge pull request #1 from liruqi/patch-2
更新 *重写带 copy 关键字的 setter* 的答案
Configuration menu - View commit details
-
Copy full SHA for be757c7 - Browse repository at this point
Copy the full SHA be757c7View commit details
Commits on Oct 30, 2015
-
Configuration menu - View commit details
-
Copy full SHA for 464da5a - Browse repository at this point
Copy the full SHA 464da5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad9197a - Browse repository at this point
Copy the full SHA ad9197aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9483218 - Browse repository at this point
Copy the full SHA 9483218View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9354dd0 - Browse repository at this point
Copy the full SHA 9354dd0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 48dce04 - Browse repository at this point
Copy the full SHA 48dce04View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ca28ac - Browse repository at this point
Copy the full SHA 8ca28acView commit details -
Configuration menu - View commit details
-
Copy full SHA for a614da9 - Browse repository at this point
Copy the full SHA a614da9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 082730b - Browse repository at this point
Copy the full SHA 082730bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 38ddaf6 - Browse repository at this point
Copy the full SHA 38ddaf6View commit details
Commits on Oct 31, 2015
-
Configuration menu - View commit details
-
Copy full SHA for 7dcb9d0 - Browse repository at this point
Copy the full SHA 7dcb9d0View commit details -
Configuration menu - View commit details
-
Copy full SHA for fe6813d - Browse repository at this point
Copy the full SHA fe6813dView commit details
Commits on Nov 2, 2015
-
Configuration menu - View commit details
-
Copy full SHA for 365fe63 - Browse repository at this point
Copy the full SHA 365fe63View commit details -
Configuration menu - View commit details
-
Copy full SHA for 07dc88c - Browse repository at this point
Copy the full SHA 07dc88cView commit details
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff master...master