mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Render examples.
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
// A dynamically-sized array of bits.
|
||||
package container_dynamic_bit_array
|
||||
|
||||
/*
|
||||
A dynamically-sized array of bits.
|
||||
|
||||
The Bit Array can be used in several ways:
|
||||
|
||||
By default you don't need to instantiate a Bit Array.
|
||||
By default you don't need to instantiate a `Bit_Array`.
|
||||
Example:
|
||||
package test
|
||||
|
||||
@@ -21,11 +20,11 @@ Example:
|
||||
|
||||
// returns `false`, `false`, because this Bit Array wasn't created to allow negative indices.
|
||||
was_set, was_retrieved := get(&bits, -1)
|
||||
fmt.println(was_set, was_retrieved)
|
||||
fmt.println(was_set, was_retrieved)
|
||||
destroy(&bits)
|
||||
}
|
||||
|
||||
A Bit Array can optionally allow for negative indices, if the minimum value was given during creation.
|
||||
A `Bit_Array` can optionally allow for negative indices, if the minimum value was given during creation.
|
||||
Example:
|
||||
package test
|
||||
|
||||
@@ -51,4 +50,5 @@ Example:
|
||||
fmt.printf("Get(Negative_Test): %v, %v\n", get(bits, Foo.Negative_Test))
|
||||
fmt.printf("Freed.\n")
|
||||
}
|
||||
*/
|
||||
*/
|
||||
package container_dynamic_bit_array
|
||||
@@ -1,10 +1,7 @@
|
||||
// An intrusive doubly-linked list.
|
||||
package container_intrusive_list
|
||||
|
||||
/*
|
||||
Package list implements an intrusive doubly-linked list.
|
||||
An intrusive doubly-linked list.
|
||||
|
||||
An intrusive container requires a `Node` to be embedded in your own structure, like this.
|
||||
The intrusive container requires a `Node` to be embedded in your own structure, like this.
|
||||
Example:
|
||||
My_String :: struct {
|
||||
node: list.Node,
|
||||
@@ -48,4 +45,5 @@ Example:
|
||||
Output:
|
||||
Hello
|
||||
World
|
||||
*/
|
||||
*/
|
||||
package container_intrusive_list
|
||||
@@ -1,8 +1,7 @@
|
||||
// A dynamic array-like interface on a stack-allocated, fixed-size array.
|
||||
package container_small_array
|
||||
|
||||
/*
|
||||
The Small_Array type is optimal for scenarios where you need
|
||||
A dynamic array-like interface on a stack-allocated, fixed-size array.
|
||||
|
||||
The `Small_Array` type is optimal for scenarios where you need
|
||||
a container for a fixed number of elements of a specific type,
|
||||
with the total number known at compile time but the exact
|
||||
number to be used determined at runtime.
|
||||
@@ -33,7 +32,7 @@ Example:
|
||||
return
|
||||
}
|
||||
|
||||
// the Small_Array can be an ordinary parameter 'generic' over
|
||||
// the `Small_Array` can be an ordinary parameter 'generic' over
|
||||
// the actual length to be usable with different sizes
|
||||
print_elements :: proc(arr: ^small_array.Small_Array($N, rune)) {
|
||||
for r in small_array.slice(arr) {
|
||||
@@ -51,4 +50,5 @@ Output:
|
||||
|
||||
Hellope
|
||||
|
||||
*/
|
||||
*/
|
||||
package container_small_array
|
||||
Reference in New Issue
Block a user