diff options
| author | Tyge Løvset <[email protected]> | 2023-01-18 10:39:48 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-01-18 10:39:48 +0100 |
| commit | e879cf117e34aa269cbdd6d73b63325d1e92da7d (patch) | |
| tree | 22b8c448c41a77a4bdfe59c01e1706d72963c615 /misc/examples | |
| parent | 17a70908cab0e4064e4913d4f1a109569d24295f (diff) | |
| download | STC-modified-e879cf117e34aa269cbdd6d73b63325d1e92da7d.tar.gz STC-modified-e879cf117e34aa269cbdd6d73b63325d1e92da7d.zip | |
Reverted to use self pointers instead of values, as cspan is not a pure view, but can modify its elements.
Diffstat (limited to 'misc/examples')
| -rw-r--r-- | misc/examples/multidim.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/misc/examples/multidim.c b/misc/examples/multidim.c index 11418e15..945741b1 100644 --- a/misc/examples/multidim.c +++ b/misc/examples/multidim.c @@ -27,16 +27,16 @@ int main() // write data using 2D view for (unsigned i=0; i != ms2.dim[0]; i++) for (unsigned j=0; j != ms2.dim[1]; j++) - *cspan_at(ms2, i, j) = i*1000 + j; + *cspan_at(&ms2, i, j) = i*1000 + j; // print all items using 1D view printf("all: "); - for (unsigned i=0; i != cspan_size(ms1); i++) - printf(" %d", *cspan_at(ms1, i)); + for (unsigned i=0; i != cspan_size(&ms1); i++) + printf(" %d", *cspan_at(&ms1, i)); puts(""); // or iterate a subspan... - ispan2 sub = cspan_at3(ms3, 1); + ispan2 sub = cspan_at3(&ms3, 1); printf("sub: "); c_FOREACH (i, ispan2, sub) printf(" %d", *i.ref); @@ -49,7 +49,7 @@ int main() for (unsigned j=0; j != ms3.dim[1]; j++) { for (unsigned k=0; k != ms3.dim[2]; k++) - printf("%d ", *cspan_at(ms3, i, j, k)); + printf("%d ", *cspan_at(&ms3, i, j, k)); puts(""); } } |
