Allow for memory reuse by reading into already existing buffers#41
Allow for memory reuse by reading into already existing buffers#41kstppd wants to merge 3 commits intollohse:masterfrom
Conversation
|
Thank you for your contribution. I cannot quite figure out what the use case of this interface is, though. Could you elaborate a bit? Are you thinking of something specific? |
|
Hi there, |
|
Yes, such an interface definitely makes sense. I am a bit hesitant with the one you suggest, though. It makes perfect sense for your specific use case but is still quite restrictive because it requires the data to be owned by an npy_data object. How about an interface where you just specify a view/pointer to the buffer? I can think of 3 interfaces:
It could be used like this: #include "npy.hpp"
#include <vector>
#include <string>
int main() {
std::vector<double> data;
data.resize(1024);
const std::string path{"in.npy"};
auto d = npy::read_npy<double,data::iterator>(path, d.begin(), d.size());
}What do you think? |
No description provided.