Struct FixedListFloat32
An unmanaged, resizable list of float that does not allocate memory. It is 32 bytes in size, and contains all the memory it needs.
Namespace: Unity.Collections
Syntax
public struct FixedListFloat32 : INativeList<float>, IEnumerable<float>, IEnumerable, IEquatable<FixedListFloat32>, IComparable<FixedListFloat32>, IEquatable<FixedListFloat64>, IComparable<FixedListFloat64>, IEquatable<FixedListFloat128>, IComparable<FixedListFloat128>, IEquatable<FixedListFloat512>, IComparable<FixedListFloat512>, IEquatable<FixedListFloat4096>, IComparable<FixedListFloat4096>
Constructors
FixedListFloat32(FixedListFloat128)
Constructs a new FixedListFloat32 that is a copy of a FixedListFloat128.
Declaration
public FixedListFloat32(in FixedListFloat128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat128 | other | The FixedListFloat128 to copy |
FixedListFloat32(FixedListFloat4096)
Constructs a new FixedListFloat32 that is a copy of a FixedListFloat4096.
Declaration
public FixedListFloat32(in FixedListFloat4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat4096 | other | The FixedListFloat4096 to copy |
FixedListFloat32(FixedListFloat512)
Constructs a new FixedListFloat32 that is a copy of a FixedListFloat512.
Declaration
public FixedListFloat32(in FixedListFloat512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat512 | other | The FixedListFloat512 to copy |
FixedListFloat32(FixedListFloat64)
Constructs a new FixedListFloat32 that is a copy of a FixedListFloat64.
Declaration
public FixedListFloat32(in FixedListFloat64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat64 | other | The FixedListFloat64 to copy |
Properties
Capacity
The number of items that can fit in the list.
Declaration
public int Capacity { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The number of items that the list can hold. |
Implements
Remarks
Capacity specifies the number of items the list can currently hold. You can not change Capacity to fit more or fewer items.
Item[Int32]
Retrieve a member of the list by index.
Declaration
public float this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index into the list. |
Property Value
Type | Description |
---|---|
Single | The list item at the specified index. |
Implements
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if index is negative or >= to Length. |
Length
The current number of items in the list.
Declaration
public int Length { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The item length. |
Implements
Methods
Add(Single)
Adds an element to the list.
Declaration
public void Add(float item)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The float to be added at the end of the list. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if list is already full. See Capacity. |
AddNoResize(Single)
Adds an element to the list.
Declaration
public void AddNoResize(float item)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The float to be added at the end of the list. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if list is already full. See Capacity. |
Clear()
Clears the list.
Declaration
public void Clear()
CompareTo(FixedListFloat128)
Compares this instance with a specified FixedListFloat128 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListFloat128.
Declaration
public int CompareTo(FixedListFloat128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat128 | other | The specified FixedListFloat128 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListFloat32)
Compares this instance with a specified FixedListFloat32 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListFloat32.
Declaration
public int CompareTo(FixedListFloat32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | other | The specified FixedListFloat32 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListFloat4096)
Compares this instance with a specified FixedListFloat4096 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListFloat4096.
Declaration
public int CompareTo(FixedListFloat4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat4096 | other | The specified FixedListFloat4096 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListFloat512)
Compares this instance with a specified FixedListFloat512 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListFloat512.
Declaration
public int CompareTo(FixedListFloat512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat512 | other | The specified FixedListFloat512 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListFloat64)
Compares this instance with a specified FixedListFloat64 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListFloat64.
Declaration
public int CompareTo(FixedListFloat64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat64 | other | The specified FixedListFloat64 to compare with |
Returns
Type | Description |
---|---|
Int32 |
Contains(Single)
Determines whether an element is in the FixedListFloat32.
Declaration
public bool Contains(float item)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The object to locate in the FixedListFloat32. |
Returns
Type | Description |
---|---|
Boolean |
ElementAt(Int32)
Declaration
public float ElementAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Single |
Implements
Equals(Object)
Compares this instance with a specified object and indicates whether this instance is equal to the specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The specified object to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(FixedListFloat128)
Compares this instance with a specified FixedListFloat128 and indicates whether this instance is equal to the specified FixedListFloat128.
Declaration
public bool Equals(FixedListFloat128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat128 | other | The specified FixedListFloat128 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListFloat32)
Compares this instance with a specified FixedListFloat32 and indicates whether this instance is equal to the specified FixedListFloat32.
Declaration
public bool Equals(FixedListFloat32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | other | The specified FixedListFloat32 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListFloat4096)
Compares this instance with a specified FixedListFloat4096 and indicates whether this instance is equal to the specified FixedListFloat4096.
Declaration
public bool Equals(FixedListFloat4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat4096 | other | The specified FixedListFloat4096 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListFloat512)
Compares this instance with a specified FixedListFloat512 and indicates whether this instance is equal to the specified FixedListFloat512.
Declaration
public bool Equals(FixedListFloat512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat512 | other | The specified FixedListFloat512 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListFloat64)
Compares this instance with a specified FixedListFloat64 and indicates whether this instance is equal to the specified FixedListFloat64.
Declaration
public bool Equals(FixedListFloat64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat64 | other | The specified FixedListFloat64 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
GetEnumerator()
Returns an enumerator that iterates through a container.
Declaration
public FixedListFloat32.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
FixedListFloat32.Enumerator | An IEnumerator object that can be used to iterate through the container. |
GetHashCode()
Computes a hash code summary of the FixedListFloat32.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
IndexOf(Single)
Searches for the specified float and returns the zero-based index of the first occurrence within the entire FixedListFloat32.
Declaration
public int IndexOf(float item)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The float to locate in the FixedListFloat32. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(Single, Int32)
Searches for the specified float and returns the zero-based index of the first occurrence within the range of elements in the FixedListFloat32 that starts at the specified index.
Declaration
public int IndexOf(float item, int index)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The float to locate in the FixedListFloat32. |
Int32 | index | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(Single, Int32, Int32)
Searches for the specified float and returns the zero-based index of the first occurrence within the range of elements in the FixedListFloat32 that starts at the specified index and contains the specified number of elements.
Declaration
public int IndexOf(float item, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The float to locate in the FixedListFloat32. |
Int32 | index | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |
Int32 | count | The number of elements in the section to search. |
Returns
Type | Description |
---|---|
Int32 |
Insert(Int32, Single)
Inserts a single element into a FixedListFloat32 at a specified zero-based index.
Declaration
public void Insert(int index, float item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which the new element should be inserted. |
Single | item | The element to insert |
InsertRange(Int32, Int32)
Inserts a number of items into a FixedListFloat32 at a specified zero-based index.
Declaration
public void InsertRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The zero-based index at which the new elements should be inserted. |
Int32 | end | The zero-based index just after where the elements should be removed. |
Remove(Single)
Searches for the specified float from the begining of the FixedListFloat32 forward, removes it if possible, and returns true if the float was successfully removed.
Declaration
public bool Remove(float item)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The float to locate in the FixedListFloat32 |
Returns
Type | Description |
---|---|
Boolean |
RemoveAt(Int32)
Removes the float at the specified index, and copies all subsequent elements backward to fill the hole so created.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which to remove the float |
RemoveAtSwapBack(Int32)
Truncates the list by replacing the item at the specified index with the last item in the list. The list is shortened by one.
Declaration
public void RemoveAtSwapBack(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the item to delete. |
RemoveRange(Int32, Int32)
Truncates the list by removing the items at the specified index range, and shifting all remaining items to replace removed items. The list is shortened by number of elements in range.
Declaration
public void RemoveRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The first index of the item to remove. |
Int32 | end | The index past-the-last item to remove. |
Remarks
This method of removing item(s) is useful only in case when list is ordered and user wants to preserve order
in list after removal In majority of cases is not important and user should use more performant RemoveRangeSwapBack
.
RemoveRangeSwapBack(Int32, Int32)
Truncates the list by replacing the item at the specified index range with the items from the end the list. The list is shortened by number of elements in range.
Declaration
public void RemoveRangeSwapBack(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The first index of the item to remove. |
Int32 | end | The index past-the-last item to remove. |
RemoveSwapBack(Single)
Removes the first occurrence of an item from the FixedListFloat32 and replaces it with the last element, which can be much faster than copying down all subsequent elements.
Declaration
public void RemoveSwapBack(float item)
Parameters
Type | Name | Description |
---|---|---|
Single | item | The elements to remove from the FixedListFloat32. |
Sort()
Sorts the elements in this FixedListFloat32.
Declaration
public void Sort()
ToArray()
Creates a managed Array of float that is a copy of this FixedListFloat32.
Declaration
public float[] ToArray()
Returns
Type | Description |
---|---|
Single[] |
ToNativeArray(Allocator)
Creates an unmanaged NativeArrayfloat that is a copy of this FixedListFloat32.
Declaration
public NativeArray<float> ToNativeArray(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | A member of the Unity.Collections.Allocator enumeration. |
Returns
Type | Description |
---|---|
NativeArray<Single> |
Operators
Equality(FixedListFloat32, FixedListFloat128)
Determines whether a FixedListFloat32 and FixedListFloat128 have the same value.
Declaration
public static bool operator ==(in FixedListFloat32 a, in FixedListFloat128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for equality |
FixedListFloat128 | b | The FixedListFloat128 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListFloat32, FixedListFloat32)
Determines whether a FixedListFloat32 and FixedListFloat32 have the same value.
Declaration
public static bool operator ==(in FixedListFloat32 a, in FixedListFloat32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for equality |
FixedListFloat32 | b | The FixedListFloat32 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListFloat32, FixedListFloat4096)
Determines whether a FixedListFloat32 and FixedListFloat4096 have the same value.
Declaration
public static bool operator ==(in FixedListFloat32 a, in FixedListFloat4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for equality |
FixedListFloat4096 | b | The FixedListFloat4096 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListFloat32, FixedListFloat512)
Determines whether a FixedListFloat32 and FixedListFloat512 have the same value.
Declaration
public static bool operator ==(in FixedListFloat32 a, in FixedListFloat512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for equality |
FixedListFloat512 | b | The FixedListFloat512 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListFloat32, FixedListFloat64)
Determines whether a FixedListFloat32 and FixedListFloat64 have the same value.
Declaration
public static bool operator ==(in FixedListFloat32 a, in FixedListFloat64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for equality |
FixedListFloat64 | b | The FixedListFloat64 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Implicit(FixedListFloat128 to FixedListFloat32)
Implicitly converts a FixedListFloat128 to a FixedListFloat32.
Declaration
public static implicit operator FixedListFloat32(in FixedListFloat128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat128 | other | The FixedListFloat128 to copy |
Returns
Type | Description |
---|---|
FixedListFloat32 |
Implicit(FixedListFloat4096 to FixedListFloat32)
Implicitly converts a FixedListFloat4096 to a FixedListFloat32.
Declaration
public static implicit operator FixedListFloat32(in FixedListFloat4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat4096 | other | The FixedListFloat4096 to copy |
Returns
Type | Description |
---|---|
FixedListFloat32 |
Implicit(FixedListFloat512 to FixedListFloat32)
Implicitly converts a FixedListFloat512 to a FixedListFloat32.
Declaration
public static implicit operator FixedListFloat32(in FixedListFloat512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat512 | other | The FixedListFloat512 to copy |
Returns
Type | Description |
---|---|
FixedListFloat32 |
Implicit(FixedListFloat64 to FixedListFloat32)
Implicitly converts a FixedListFloat64 to a FixedListFloat32.
Declaration
public static implicit operator FixedListFloat32(in FixedListFloat64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat64 | other | The FixedListFloat64 to copy |
Returns
Type | Description |
---|---|
FixedListFloat32 |
Inequality(FixedListFloat32, FixedListFloat128)
Determines whether a FixedListFloat32 and FixedListFloat128 have different values.
Declaration
public static bool operator !=(in FixedListFloat32 a, in FixedListFloat128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for inequality |
FixedListFloat128 | b | The FixedListFloat128 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListFloat32, FixedListFloat32)
Determines whether a FixedListFloat32 and FixedListFloat32 have different values.
Declaration
public static bool operator !=(in FixedListFloat32 a, in FixedListFloat32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for inequality |
FixedListFloat32 | b | The FixedListFloat32 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListFloat32, FixedListFloat4096)
Determines whether a FixedListFloat32 and FixedListFloat4096 have different values.
Declaration
public static bool operator !=(in FixedListFloat32 a, in FixedListFloat4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for inequality |
FixedListFloat4096 | b | The FixedListFloat4096 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListFloat32, FixedListFloat512)
Determines whether a FixedListFloat32 and FixedListFloat512 have different values.
Declaration
public static bool operator !=(in FixedListFloat32 a, in FixedListFloat512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for inequality |
FixedListFloat512 | b | The FixedListFloat512 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListFloat32, FixedListFloat64)
Determines whether a FixedListFloat32 and FixedListFloat64 have different values.
Declaration
public static bool operator !=(in FixedListFloat32 a, in FixedListFloat64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListFloat32 | a | The FixedListFloat32 to compare for inequality |
FixedListFloat64 | b | The FixedListFloat64 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |