Thanks, I absolutely agree with you, in principle. However, there is no escaping the
std::move(data) in the Example<> constructor. This means that any Tensor I create locally and use to create an element of a Dataset will be invalidated when I create an Example<Tensor,Tensor>.
This has no impact on my current implementation, because in all cases where I do that, the local Tensor objects are allowed to go out of scope without accessing them again. My main concern is when I am passing around containers which have Tensors somewhere in them.
I may just have to try some things, and hover over the running code with my handy ‘gdb’ (or alternatively just let valgrind do the heavy lifting), in case something gets pulled out from under me.
As I said, a working example involving something more complicated than the available tutorials might be helpful. I am going to leave the topic open for at least a bit, in case a C++ frontend guru chimes in.