RaggedArray
final class RaggedArray<Type>
Two-dimensional array where each row has a varying length. Internally, this is stored in one contiguous array for constant-time random access.
- Type Element type. Must be default-constructible.
Slices
| Name | Description |
|---|---|
| [...] | Reference to an element. |
Member Variables
| Name | Description |
|---|---|
| values:Array<Array<Type>> | Elements. |
Member Functions
| Name | Description |
|---|---|
| empty | Is this empty? |
| clear | Clear all rows. |
| count | Number of elements. |
| size | Number of rows. |
| size | Number of elements for a given row. |
| get | Get an element. |
| get | Get a row. |
| set | Set an element. |
| set | Set a row. |
| popFront | Remove the front row. |
| popFront | Remove the front element from a specified row. |
| pushBack | Add a new row at the back. |
| pushBack | Add an element to the back of a specified row. |
| pushBack | Add a new default-constructed element to the back of the specified row, and return the element. |
| walk | Obtain an iterator over rows. |
| walk | Obtain an iterator over columns. |
Member Slice Details
Member Function Details
clear
function clear()
Clear all rows.
count
function count() -> Integer
Number of elements.
empty
function empty() -> Boolean
Is this empty? A RaggedArray is considered empty if it has no rows. A RaggedArray with one or more rows is not considered empty, even if those rows have no elements.
get
popFront
function popFront()
Remove the front row.
pushBack
function pushBack()
Add a new row at the back.
function pushBack(i:Integer) -> Type
Add a new default-constructed element to the back of the specified row, and return the element.
set
size
function size() -> Integer
Number of rows.