blitz icon indicating copy to clipboard operation
blitz copied to clipboard

Convert TinyVector to std::array (C++11)

Open citibeth opened this issue 10 years ago • 3 comments

It seems that TinyVector and std::array do the same thing. So consider typedefing one to the other when using a C++11 compiler.

citibeth avatar Jan 19 '16 18:01 citibeth

Unless I'm mistaken, std::array does not define any math operators. That said, it might be possible to usefully leverage it as the backend to TinyVector.

lutorm avatar Jan 19 '16 19:01 lutorm

In using blitz::Array, I'm doing too many unnecessary conversions between std::array and TinyVector. We can define the math operations externally to the class. But yes, it seems that simple typedef won't work.

On Tue, Jan 19, 2016 at 2:35 PM, lutorm [email protected] wrote:

Unless I'm mistaken, std::array does not define any math operators. That said, it might be possible to usefully leverage it as the backend to TinyVector.

— Reply to this email directly or view it on GitHub https://github.com/blitzpp/blitz/issues/10#issuecomment-172961519.

citibeth avatar Jan 19 '16 19:01 citibeth

Maybe the solution is to add an implicit constructor to TinyVector from std::array. The "needless" conversion would still be happening. But it would now be under the hood and we probably won't care. This would be a more backwards-compatible way of doing things.

On Tue, Jan 19, 2016 at 2:42 PM, Elizabeth Fischer [email protected] wrote:

In using blitz::Array, I'm doing too many unnecessary conversions between std::array and TinyVector. We can define the math operations externally to the class. But yes, it seems that simple typedef won't work.

On Tue, Jan 19, 2016 at 2:35 PM, lutorm [email protected] wrote:

Unless I'm mistaken, std::array does not define any math operators. That said, it might be possible to usefully leverage it as the backend to TinyVector.

— Reply to this email directly or view it on GitHub https://github.com/blitzpp/blitz/issues/10#issuecomment-172961519.

citibeth avatar Jan 19 '16 20:01 citibeth