-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cast fixed-length string -> std::string
missing
#505
Comments
Hey.
|
Thanks for replying. I think my comment here best describes my problem: #94 (comment). Looking through the document, I cannot find a way to construct |
I think the problem here is that Therefore,
works but
doesn't. |
Oh, I'm sorry I overlooked the fact that the signature of FixedLenStringArray is |
I'll try to look into this in my free time. For now, I will simply set |
@JATC1024 You probably have a good reason to do what you do. Still, auto mystring = H5Easy::load<std::string>(file, "/path/to/my/string"); Also, unlike @ferdonline I'm not super sure that a 'fixed-size' string object that is dynamically allocated is relevant. Wouldn't that we |
@tdegeus
For variable-length strings, this works. For fixed-length strings, it shows the error Or are you suggesting that I can load each string in the array individually? Something like
I see you do have a function like that. I will try it tomorrow, though I think I will get the same error. |
Thanks for the clarification @JATC1024 . This makes a lot of sense. I should say that I'm not at all an expert on HDF5 fixed-length strings. That being said, I see no reason why |
Shall we rename this issue (or open a new one) indicating that it is more than missing conversion from fixed-length strings to |
@tdegeus sure, whatever way you see fit. If you create a new one then I think we can close this one. |
std::string
missing
With #744 merged std::strings and containers thereof, e.g. std::vectorstd::string can be read and written to fixed or variable length HDF5 strings. There's an example here: |
Is your feature request related to a problem? Please describe.
H5Easy.load cannot load fixed length strings. I always get the error
Can't output std::string as fixed-length. Use raw arrays or FixedLenStringArray
. I tried to useHighFive::FixedLenStringArray<N>
and it worked. However, I had to know the length of the strings beforehand since N must be a constant. This does not seem viable to me.Describe the solution you'd like
Something like
would be nice. Or even better if
H5Easy
will handle everything so that I don't have to care if the dataset is fixed length or not.The text was updated successfully, but these errors were encountered: