大佬教程收集整理的这篇文章主要介绍了找到《Learn iPhone and iPad Cocos2D Game Development》一书翻译中的一处错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
《Learn iPhone and iPad Cocos2D Game Development》一书有一段关于CCArray的描述:
CCArray通过将数组中的最后一个对象(nil)赋值给删除的位置,实现了fastRemoveObject和fastRemoveObjectATindex两个方法。避免了复制部份数组的内存。这让删除数组中的元素变的更快,不过这也意味着CCArray中的对象会改变位置。
/** Removes object at specified index and fills the gap with the last object,thereby avoiding the need to push BACk subsequent objects. BehavIoUr undefined if index outside [0,num-1]. */ static inline void ccArrayFastRemoveObjectATindex(ccArray *arr,NSUInteger indeX) { [arr->arr[index] release]; NSUInteger last = --arr->num; arr->arr[index] = arr->arr[last]; }
很明显,最后一个对象并不是nil。翻译者画蛇添足,会造成一些读者理解上的困扰!
以上是大佬教程为你收集整理的找到《Learn iPhone and iPad Cocos2D Game Development》一书翻译中的一处错误全部内容,希望文章能够帮你解决找到《Learn iPhone and iPad Cocos2D Game Development》一书翻译中的一处错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。