-
I have a pointer to an array, and I know the shape. Can I write it as a 2D array? The following code will throw an exception of float* raw = ...;
HighFive::DataSet dataset = file.createDataSet<float>("dataset", HighFive::DataSpace({2, 3}));
dataset.write(raw); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Closed: the solution is |
Beta Was this translation helpful? Give feedback.
-
There's
See https://github.com/BlueBrain/HighFive/blob/master/src/examples/read_write_raw_ptr.cpp for a full example. (Note that due to an asymmetry, there's no corresponding |
Beta Was this translation helpful? Give feedback.
The downside of this is that when presented with a
float**
we can't know if it's contiguous or not, e.g.Currently, HighFive doesn't seem to respect the possibility of non-contiguous pointer-to-pointer. Hence, it might work. However, the version I posted should be preferred.