ksnowlv

回顾过去,总结以往;立足现在,铭记当下;技术为主,笔记而已.

iOS指针集合类

| Comments

Collections之Pointer Collections :指针集合类

    1. NSPointerArray
    1. NSHashTable
    1. NSMapTable

1.NSPointerFunctionsOptions

Defines the memory and personality options for an NSPointerFunctions object.

  • NSPointerFunctionsMachVirtualMemory
  • NSPointerFunctionsMallocMemory

       Use free() on removal, calloc() on copy in.
    
  • NSPointerFunctionsOpaqueMemory

  • NSPointerFunctionsStrongMemory
  • NSPointerFunctionsWeakMemory

      Uses weak read and write barriers appropriate for ARC or GC. Using NSPointerFunctionsWeakMemory object references will turn to NULL on last release.
    
  • NSMapTableStrongMemory

    Equivalent to NSPointerFunctionsStrongMemory .

  • NSMapTableWeakMemory

      Equivalent to NSPointerFunctionsWeakMemory.
    

2. NSPointerArray/NSHashTable/NSMapTable

  • 可以存储所有指针类型的数据包括nil
  • 可以添加或删除nil values
  • 可以弱引用或强引用对象。
  • 添加元素时,性能很差。慎用!!!

Comments

comments powered by Disqus
Included file 'custom/after_footer.html' not found in _includes directory