If I were to use the C++/C API to write simple 1D vectors, like
std::vector<double> errors (100, 0); what would be the simplest way to achieve this?
&(errors) is used to get a pointer to the underlying vector storage (note that vector storage is guaranteed to be contiguous). In that way you can use the C API. However, this cannot be done for bool vectors before C++11 since they are represented as bits.
If you have access to C++11, then you can use
errors.data(); instead of the
Suggestion from a user: I wrote this templated function years ago but we still use it in our production code. The complete context of the function can be found at https://github.com/BlueQuartzSoftware/SIMPL/blob/develop/Source/H5Support/H5Lite.h
Code below starts on line 234 of the file above. Hope this helps.