UnsafePtrList<T>
An unmanaged, resizable list of pointers.
Read time 2 minutesLast updated 13 days ago
Definition
- Type: Struct
- Namespace: Unity.Collections.LowLevel.Unsafe
- Assembly: UnityEngine.ManagedKernelModule
- Implements: INativeDisposable, IDisposable, IEnumerable<IntPtr>, IEnumerable
public struct UnsafePtrList<T> : INativeDisposable, IDisposable, IEnumerable<nint>, IEnumerable where T : unmanaged
Fields
Value | Description |
|---|---|
| Allocator | The allocator used to create the internal buffer. |
| m_capacity | The number of elements that can fit in the internal buffer. |
| m_length | The number of elements. |
| Ptr | The internal buffer of this list. |
Constructors
Constructor | Description |
|---|---|
| UnsafePtrList`1(`0**,System.Int32) | Initializes and returns an instance of UnsafePtrList. |
| UnsafePtrList`1(System.Int32,Unity.Collections.AllocatorManager.AllocatorHandle,Unity.Collections.NativeArrayOptions) | Initializes and returns an instance of UnsafePtrList. |
Properties
Property | Description |
|---|---|
| Capacity | The number of elements that can fit in the internal buffer. |
| IsCreated | Whether this list has been allocated (and not yet deallocated). |
| IsEmpty | Whether the list is empty. |
| this[] | The element at an index. |
| Length | The number of elements. |
Methods
Method | Description |
|---|---|
| Add | Adds a pointer to the end of the list. |
| AddNoResize | Adds a pointer to the end of this list. |
| AddRange | Adds elements from a buffer to this list. |
| AddRangeNoResize | Copies pointers from a buffer to the end of this list. |
| AsParallelReader | Obsolete. Use UnsafePtrList<T>.AsReadOnly instead. |
| AsParallelWriter | Returns a parallel writer of this list. |
| AsReadOnly | Returns a read only of this list. |
| Clear | Sets the length to 0. |
| Contains | Returns true if the list contains at least one occurrence of a specific pointer. |
| Dispose | Releases all resources (memory). |
| ElementAt | Returns a reference to the element at a given index. |
| IndexOf | Returns the index of the first occurrence of a specific pointer in the list. |
| InsertRangeWithBeginEnd | Shifts pointers toward the end of this list, increasing its length. |
| RemoveAt | Removes the pointer at an index, shifting everything above it down by one. Decrements the length by 1. |
| RemoveAtSwapBack | Copies the last pointer of this list to the specified index. Decrements the length by 1. |
| RemoveRange | Removes "N" pointers in a range, shifting everything above the range down by "N". Decrements the length by "N". |
| RemoveRangeSwapBack | Copies the last "N" pointer of this list to a range in this list. Decrements the length by "N". |
| Resize | Sets the length, expanding the capacity if necessary. |
| SetCapacity | Sets the capacity. |
| TrimExcess | Sets the capacity to match the length. |
Static Methods
Structs
Struct | Description |
|---|---|
| UnsafePtrList<T>.ParallelReader | Obsolete. Use UnsafePtrList<T>.ReadOnly instead. |
| UnsafePtrList<T>.ParallelWriter | A parallel writer for an UnsafePtrList\<T\>. |
| UnsafePtrList<T>.ReadOnly | A read only for an UnsafePtrList\<T\>. |