Skip to content

Commit

Permalink
fixup: example.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed May 9, 2024
1 parent 3489d48 commit c6e139e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/examples/broadcasting_arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ int main(void) {

auto dset = file.createDataSet("dset", DataSpace(dims), create_datatype<double>());

// Note that even though `values` is one-dimensional, we can still write it
// to an array of dimensions `[3, 1]`. Only the number of elements needs to
// match.
dset.write(values);
// Note that because `values` is one-dimensional, we can't write it
// to a dataset of dimensions `[3, 1]` directly. Instead we use:
dset.squeezeMemSpace({1}).write(values);

// When reading, (re-)allocation might occur. The shape to be allocated is
// the dimensions of the memspace. Therefore, one might want to either remove
Expand Down

0 comments on commit c6e139e

Please sign in to comment.