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

Data::grid() version that allocates memory #264

Open
LourensVeen opened this issue Aug 25, 2023 · 1 comment
Open

Data::grid() version that allocates memory #264

LourensVeen opened this issue Aug 25, 2023 · 1 comment

Comments

@LourensVeen
Copy link
Contributor

Currently, when you're creating a Data::grid() you need to pass a pointer to a pre-existing array with data. If the original data are in a format that's not an array layout, then that's no good.

In that case, you need to allocate some memory, copy (or gather, or whatever) the data in there in the right order, and then create your Data object. But now if you want to return that Data object from a function that created it, you'll have to return some other object owning the memory along with it, and that's annoying.

So it would be nice if we could have a Data::grid() that doesn't take a data pointer but only type, indexes and storage order, and that would allocate the memory internally and own it.

If we make a non-const version of the accessor functions in #251, then that can be used to write in the values.

@LourensVeen
Copy link
Contributor Author

This would also improve regularity, since for Data::byte_array we do have both.

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

No branches or pull requests

1 participant