aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-11-21 19:36:07 +0000
committergingerBill <bill@gingerbill.org>2019-11-21 19:36:07 +0000
commit9b58781122aaed23f3952eff6ba749e62a04a2ae (patch)
tree823b1cc1d758c1ad93e2497f40cf490b7da3efdd /examples
parentb74f8f204776c7cacc22fcbb44898ea496e02645 (diff)
#soa[dynamic]Type (Experimental)
Diffstat (limited to 'examples')
-rw-r--r--examples/demo/demo.odin11
1 files changed, 10 insertions, 1 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin
index 235402f18..604d56695 100644
--- a/examples/demo/demo.odin
+++ b/examples/demo/demo.odin
@@ -1727,7 +1727,8 @@ soa_struct_layout :: proc() {
}
{
// SOA Slices
- Vector3 :: struct {x, y, z: f32};
+ // Vector3 :: struct {x, y, z: f32};
+ Vector3 :: struct {x: i8, y: i16, z: f32};
N :: 3;
v: #soa[N]Vector3;
@@ -1744,6 +1745,14 @@ soa_struct_layout :: proc() {
a := s[1:2];
assert(len(a) == 1);
fmt.println(a);
+
+ d: #soa[dynamic]Vector3;
+
+ append_soa(&d, Vector3{1, 2, 3}, Vector3{4, 5, 9}, Vector3{-4, -4, 3});
+ fmt.println(d);
+ fmt.println(len(d));
+ fmt.println(cap(d));
+ fmt.println(d[:]);
}
}