Closed pgrete closed 6 months ago
Is this safe (i.e., is the content of the temporary vector persistent in the openpmd-api internals) or do I need to make sure that the memory still lives until I call flush?
Yes, this is safe. The operation will generally be passed on to the I/O backend later upon flush()
ing only, but attributes don't keep handles on user data, they are stored internally.
Note also that setAttribute
uses pass-by-value, so the function header alone gives us no chance to access the user vector:
template <typename T>
inline bool Attributable::setAttribute(std::string const &key, T value)
Perfect, thanks for confirming.
I'm trying to store some data (of multiple objects) similar to
Is this safe (i.e., is the content of the temporary vector persistent in the openpmd-api internals) or do I need to make sure that the memory still lives until I call flush?
Software Environment: Have you already installed openPMD-api? If so, please tell us which version of openPMD-api your question is about: