Skip to main content
Version: 12 Dec 2024

NativeFixedList

NameSpace: MagicLeap

Has List-like semantics (Capacity and Length) using a NativeArray as the backing store. The NativeArray is never resized. This is useful for times you don't know how big the array will be, but there is a definite upper bound. This list supports duck-typed foreach Enumerator semantics. More...

Inherits from:
IEquatable< NativeFixedList< T >>,
IDisposable

Detailed Description

package template <T > struct NativeFixedList : IEquatable< NativeFixedList< T >> 

Public Fields

Capacity


public int Capacity { get; set; }


IsCreated


public bool IsCreated { get; set; }


Length


public int Length { get; set; }


this[int index]


public T this[int index] { get; set; }


Public Methods

void Add

public void Add(
T item
)

Parameters

TypeNameDescription
Titem

void Clear

public void Clear()

void CopyTo

Copies the contents of this list to another NativeArray. destination must have the same Length as this list.

public void CopyTo(
NativeArray< T > destination
)

Parameters

TypeNameDescription
NativeArray< T >destinationThe destination array

void Dispose

public void Dispose()

override bool Equals

public override bool Equals(
object obj
)

Parameters

TypeNameDescription
objectobj

bool Equals

public bool Equals(
NativeFixedList< T > other
)

Parameters

TypeNameDescription
NativeFixedList< T >other

Enumerator GetEnumerator

public Enumerator GetEnumerator()

override int GetHashCode

public override int GetHashCode()

NativeFixedList

Allocates a new NativeFixedList with Capacity . Caller must Dispose the array when no longer needed.

public NativeFixedList(
int Capacity,
Allocator allocator
)

Parameters

TypeNameDescription
intCapacity
Allocatorallocator

NativeFixedList

Create a NativeFixedList from an existing NativeArray and a length. This NativeFixedList now owns the memory and should be Disposed when finished.

public NativeFixedList(
NativeArray< T > other,
int length
)

Parameters

TypeNameDescription
NativeArray< T >otherThe array to take ownership of
intlengthThe number of elements actually used by the NativeArray

bool operator!=

public static bool operator!=(
NativeFixedList< T > lhs,
NativeFixedList< T > rhs
)

Parameters

TypeNameDescription
NativeFixedList< T >lhs
NativeFixedList< T >rhs

bool operator==

public static bool operator==(
NativeFixedList< T > lhs,
NativeFixedList< T > rhs
)

Parameters

TypeNameDescription
NativeFixedList< T >lhs
NativeFixedList< T >rhs

Public Attributes

m_NativeArray


public NativeArray< T > m_NativeArray;