Skip to content
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

A Variant-Based LoadChunk #1372

Closed
ax3l opened this issue Feb 10, 2023 · 2 comments · Fixed by #1544
Closed

A Variant-Based LoadChunk #1372

ax3l opened this issue Feb 10, 2023 · 2 comments · Fixed by #1544

Comments

@ax3l
Copy link
Member

ax3l commented Feb 10, 2023

It would be great if we can design load routines that are variant-based.

That way, the user-side logic is more concise than knowing the exact type upfront.

Similar for attribute reads (where we already support some flexible casts).

@franzpoeschel
Copy link
Contributor

The logic of our switchType thingy is very similar to std::visit and can be used today already by including DatatypeHelpers.hpp (public header on purpose). Maybe a wrapper around this would be a solution?
Otherwise, to use std::visit (which would be nice as it's well-documented STL code), we would have to use an actual std::variant somewhere, but it's probably doable too.

@ax3l
Copy link
Member Author

ax3l commented Feb 21, 2023

Things we could add:

  • public std::variant for our users for our defined types
  • return overloads that return a pre-allocated variant
  • helpers so that users can pass us a pre-allocated float (double, etc.) pointer and we write into it, converting if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants