Dear all,
I am facing quite an annoying problem I can't solve. I have a std::valarray<T>, where T can be anything and I need slices of it to work locally on them.
If the elements T contained in the valarray are big (not to say HUGE), the usage of std::slice is quite inconvenient, since temporary copies of the objects in the slice are created.
Same problem in case my T is small (let's say T = int), but my slice contains 1e6 elements.
An approach using references would be much more efficient than std::slice in my opinion, but I don't know how to implement an object like this. The only alternative to that I have in mind is to use std::valarray<T*>, but I don't really like the pointer syntax and I'd prefer to avoid it.
Any suggestions, please?
Best regards,
MrMF
I am facing quite an annoying problem I can't solve. I have a std::valarray<T>, where T can be anything and I need slices of it to work locally on them.
If the elements T contained in the valarray are big (not to say HUGE), the usage of std::slice is quite inconvenient, since temporary copies of the objects in the slice are created.
Same problem in case my T is small (let's say T = int), but my slice contains 1e6 elements.
An approach using references would be much more efficient than std::slice in my opinion, but I don't know how to implement an object like this. The only alternative to that I have in mind is to use std::valarray<T*>, but I don't really like the pointer syntax and I'd prefer to avoid it.
Any suggestions, please?
Best regards,
MrMF