Vector<T>(Standardlibrary/Containers)

Not to be confused with Vec2 and Vec3.

The Vector Type is dynamically resizeable collection of data items stored in contiguous memory.

The Vector type Can be used like so.

int[] Items;
Vector<int> Items2;

Both being equivalent.

Vector are dynamic so your able to add elements at runtime.

int[] Items;
Items.Push(5);
Items.Push(10);
Items.Push(30);


Fmt::Print(Items[0]); \\ 5
Fmt::Print(Items[1]); \\ 10
Fmt::Print(Items[2]); \\ 30


Fmt::Print(Items.Size()); \\ 3

Vector can also be can be initialized with starting elements.

int[] Items = [10,20,30];

Fmt::Print(Items[0]); \\ 5
Fmt::Print(Items[1]); \\ 10
Fmt::Print(Items[2]); \\ 30

Fmt::Print(Items.Size()); \\ 3

Member functions

SignatureDescription
|new[this&] -> void;Makes a New Vector.
|new[this&,imut this& Other] -> void;Copys a Vector
|new[this&,imut this& Other] -> void;Moves a Vector
|new<T...>[this&,imut T items] -> void;Makes a New Vector with the added elements.
|new<T...>[this&,moved T items] -> void;Makes a New Vector with the added elements.
unsafe |Data[imut this&] -> imut T[&];Gets the Raw Data Pointer.
unsafe |Data[this&] -> T[&];Gets the Raw Data Pointer.
|Size[imut this&] -> uintptr;Get the Size of the Array.
|Capacity[imut this&] -> uintptr;Gets how much memory the string allocated to hold its contents
|[][imut this&,uintptr index] -> imut T&;Gets the address of an element.
|[][this&,uintptr index] -> T&;Gets the address of an element.
|Push[this&,uintptr index] -> T&;Adds the element to the end of the Vector.

Inherited traits

TraitDescription
Buffer_t<T>Gives the types that have continuous elements helper funcions such as Sort,Find and Filter.

Notes